var Prototype={
    Version:"1.6.0.1",
    Browser:{
        IE:!!(window.attachEvent&&!window.opera),
        Opera:!!window.opera,
        WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,
        Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,
        MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
        },
    BrowserFeatures:{
        XPath:!!document.evaluate,
        ElementExtensions:!!window.HTMLElement,
        SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__
        },
    ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",
    JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,
    emptyFunction:function(){},
    K:function(A){
        return A;
    }
    };if(Prototype.Browser.MobileSafari){
    Prototype.BrowserFeatures.SpecificElementExtensions=false;
}
var Class={
    create:function(){
        var parent=null,properties=$A(arguments);if(Object.isFunction(properties[0])){
            parent=properties.shift()
            }function klass(){
            this.initialize.apply(this,arguments)
            }Object.extend(klass,Class.Methods);klass.superclass=parent;klass.subclasses=[];if(parent){
            var subclass=function(){};subclass.prototype=parent.prototype;klass.prototype=new subclass;parent.subclasses.push(klass)
            }for(var i=0;i<properties.length;i++){
            klass.addMethods(properties[i])
            }if(!klass.prototype.initialize){
            klass.prototype.initialize=Prototype.emptyFunction
            }klass.prototype.constructor=klass;return klass
        }
    };Class.Methods={
    addMethods:function(source){
        var ancestor=this.superclass&&this.superclass.prototype;var properties=Object.keys(source);if(!Object.keys({
            toString:true
        }).length){
            properties.push("toString","valueOf")
            }for(var i=0,length=properties.length;i<length;i++){
            var property=properties[i],value=source[property];if(ancestor&&Object.isFunction(value)&&value.argumentNames().first()=="$super"){
                var method=value,value=Object.extend((function(m){
                    return function(){
                        return ancestor[m].apply(this,arguments)
                        }
                    })(property).wrap(method),{
                    valueOf:function(){
                        return method
                        },
                    toString:function(){
                        return method.toString()
                        }
                    })
                }this.prototype[property]=value
            }return this
        }
    };var Abstract={};Object.extend=function(destination,source){
    for(var property in source){
        destination[property]=source[property]
        }return destination
    };Object.extend(Object,{
    inspect:function(object){
        try{
            if(Object.isUndefined(object)){
                return"undefined"
                }if(object===null){
                return"null"
                }return object.inspect?object.inspect():object.toString()
            }catch(e){
            if(e instanceof RangeError){
                return"..."
                }throw e
            }
        },
    toJSON:function(object){
        var type=typeof object;switch(type){
            case"undefined":case"function":case"unknown":return ;case"boolean":return object.toString()
                }if(object===null){
            return"null"
            }if(object.toJSON){
            return object.toJSON()
            }if(Object.isElement(object)){
            return
        }var results=[];for(var property in object){
            var value=Object.toJSON(object[property]);if(!Object.isUndefined(value)){
                results.push(property.toJSON()+": "+value)
                }
            }return"{"+results.join(", ")+"}"
        },
    toQueryString:function(object){
        return $H(object).toQueryString()
        },
    toHTML:function(object){
        return object&&object.toHTML?object.toHTML():String.interpret(object)
        },
    keys:function(object){
        var keys=[];for(var property in object){
            keys.push(property)
            }return keys
        },
    values:function(object){
        var values=[];for(var property in object){
            values.push(object[property])
            }return values
        },
    clone:function(object){
        return Object.extend({},object)
        },
    isElement:function(object){
        return object&&object.nodeType==1
        },
    isArray:function(object){
        return object&&object.constructor===Array
        },
    isHash:function(object){
        return object instanceof Hashtable
        },
    isFunction:function(object){
        return typeof object=="function"
        },
    isString:function(object){
        return typeof object=="string"
        },
    isNumber:function(object){
        return typeof object=="number"
        },
    isUndefined:function(object){
        return typeof object=="undefined"
        }
    });Object.extend(Function.prototype,{
    argumentNames:function(){
        var names=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return names.length==1&&!names[0]?[]:names
        },
    bind:function(){
        if(arguments.length<2&&Object.isUndefined(arguments[0])){
            return this
            }var __method=this,args=$A(arguments),object=args.shift();return function(){
            return __method.apply(object,args.concat($A(arguments)))
            }
        },
    bindAsEventListener:function(){
        var __method=this,args=$A(arguments),object=args.shift();return function(event){
            return __method.apply(object,[event||window.event].concat(args))
            }
        },
    curry:function(){
        if(!arguments.length){
            return this
            }var __method=this,args=$A(arguments);return function(){
            return __method.apply(this,args.concat($A(arguments)))
            }
        },
    delay:function(){
        var __method=this,args=$A(arguments),timeout=args.shift()*1000;return window.setTimeout(function(){
            return __method.apply(__method,args)
            },timeout)
        },
    wrap:function(wrapper){
        var __method=this;return function(){
            return wrapper.apply(this,[__method.bind(this)].concat($A(arguments)))
            }
        },
    methodize:function(){
        if(this._methodized){
            return this._methodized
            }var __method=this;return this._methodized=function(){
            return __method.apply(null,[this].concat($A(arguments)))
            }
        }
    });Function.prototype.defer=Function.prototype.delay.curry(0.01);Date.prototype.toJSON=function(){
    return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'
    };var Try={
    these:function(){
        var returnValue;for(var i=0,length=arguments.length;i<length;i++){
            var lambda=arguments[i];try{
                returnValue=lambda();break
            }catch(e){}
            }return returnValue
        }
    };RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(str){
    return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")
    };var PeriodicalExecuter=Class.create({
    initialize:function(callback,frequency){
        this.callback=callback;this.frequency=frequency;this.currentlyExecuting=false;this.registerCallback()
        },
    registerCallback:function(){
        this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)
        },
    execute:function(){
        this.callback(this)
        },
    stop:function(){
        if(!this.timer){
            return
        }clearInterval(this.timer);this.timer=null
        },
    onTimerEvent:function(){
        if(!this.currentlyExecuting){
            try{
                this.currentlyExecuting=true;this.execute()
                }finally{
                this.currentlyExecuting=false
                }
            }
        }
    });
Object.extend(String,{
    interpret:function(A){
        return A==null?"":String(A);
    },
    specialChar:{
        "\b":"\\b",
        "\t":"\\t",
        "\n":"\\n",
        "\f":"\\f",
        "\r":"\\r",
        "\\":"\\\\"
    }
    });Object.extend(String.prototype,{
    gsub:function(E,C){
        var A="",D=this,B;C=arguments.callee.prepareReplacement(C);while(D.length>0){
            if(B=D.match(E)){
                A+=D.slice(0,B.index);A+=String.interpret(C(B));D=D.slice(B.index+B[0].length);
            }else{
                A+=D,D="";
            }
            }return A;
    },
    sub:function(C,A,B){
        A=this.gsub.prepareReplacement(A);B=Object.isUndefined(B)?1:B;return this.gsub(C,function(D){
            if(--B<0){
                return D[0];
            }return A(D);
        });
    },
    scan:function(B,A){
        this.gsub(B,A);return String(this);
    },
    truncate:function(B,A){
        B=B||30;A=Object.isUndefined(A)?"...":A;return this.length>B?this.slice(0,B-A.length)+A:String(this);
    },
    strip:function(){
        return this.replace(/^\s+/,"").replace(/\s+$/,"");
    },
    stripTags:function(){
        return this.replace(/<\/?[^>]+>/gi,"");
    },
    stripScripts:function(){
        return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
    },
    extractScripts:function(){
        var B=new RegExp(Prototype.ScriptFragment,"img");var A=new RegExp(Prototype.ScriptFragment,"im");return(this.match(B)||[]).map(function(C){
            return(C.match(A)||["",""])[1];
        });
    },
    evalScripts:function(){
        return this.extractScripts().map(function(script){
            return eval(script);
        });
    },
    escapeHTML:function(){
        var A=arguments.callee;A.text.data=this;return A.div.innerHTML;
    },
    unescapeHTML:function(){
        var A=new Element("div");A.innerHTML=this.stripTags();return A.childNodes[0]?(A.childNodes.length>1?$A(A.childNodes).inject("",function(B,C){
            return B+C.nodeValue;
        }):A.childNodes[0].nodeValue):"";
    },
    toQueryParams:function(B){
        var A=this.strip().match(/([^?#]*)(#.*)?$/);if(!A){
            return{};
        }return A[1].split(B||"&").inject({},function(E,F){
            if((F=F.split("="))[0]){
                var C=decodeURIComponent(F.shift());var D=F.length>1?F.join("="):F[0];if(D!=undefined){
                    D=decodeURIComponent(D);
                }if(C in E){
                    if(!Object.isArray(E[C])){
                        E[C]=[E[C]];
                    }E[C].push(D);
                }else{
                    E[C]=D;
                }
                }return E;
        });
    },
    toArray:function(){
        return this.split("");
    },
    succ:function(){
        return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);
    },
    times:function(A){
        return A<1?"":new Array(A+1).join(this);
    },
    camelize:function(){
        var D=this.split("-"),A=D.length;if(A==1){
            return D[0];
        }var C=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];for(var B=1;B<A;B++){
            C+=D[B].charAt(0).toUpperCase()+D[B].substring(1);
        }return C;
    },
    capitalize:function(){
        return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();
    },
    underscore:function(){
        return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase();
    },
    dasherize:function(){
        return this.gsub(/_/,"-");
    },
    inspect:function(B){
        var A=this.gsub(/[\x00-\x1f\\]/,function(C){
            var D=String.specialChar[C[0]];return D?D:"\\u00"+C[0].charCodeAt().toPaddedString(2,16);
        });if(B){
            return'"'+A.replace(/"/g,'\\"')+'"';
        }return"'"+A.replace(/'/g,"\\'")+"'";
    },
    toJSON:function(){
        return this.inspect(true);
    },
    unfilterJSON:function(A){
        return this.sub(A||Prototype.JSONFilter,"#{1}");
    },
    isJSON:function(){
        var A=this;if(A.blank()){
            return false;
        }A=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(A);
    },
    evalJSON:function(sanitize){
        var json=this.unfilterJSON();try{
            if(!sanitize||json.isJSON()){
                return eval("("+json+")");
            }
            }catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect());
    },
    include:function(A){
        return this.indexOf(A)>-1;
    },
    startsWith:function(A){
        return this.indexOf(A)===0;
    },
    endsWith:function(A){
        var B=this.length-A.length;return B>=0&&this.lastIndexOf(A)===B;
    },
    empty:function(){
        return this=="";
    },
    blank:function(){
        return/^\s*$/.test(this);
    },
    interpolate:function(A,B){
        return new Template(this,B).evaluate(A);
    }
    });if(Prototype.Browser.WebKit||Prototype.Browser.IE){
    Object.extend(String.prototype,{
        escapeHTML:function(){
            return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
        },
        unescapeHTML:function(){
            return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">");
        }
        });
}String.prototype.gsub.prepareReplacement=function(B){
    if(Object.isFunction(B)){
        return B;
    }var A=new Template(B);return function(C){
        return A.evaluate(C);
    };
};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{
    div:document.createElement("div"),
    text:document.createTextNode("")
    });with(String.prototype.escapeHTML){
    div.appendChild(text);
    }var Template=Class.create({
    initialize:function(A,B){
        this.template=A.toString();this.pattern=B||Template.Pattern;
    },
    evaluate:function(A){
        if(Object.isFunction(A.toTemplateReplacements)){
            A=A.toTemplateReplacements();
        }return this.template.gsub(this.pattern,function(D){
            if(A==null){
                return"";
            }var F=D[1]||"";if(F=="\\"){
                return D[2];
            }var B=A,G=D[3];var E=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;D=E.exec(G);if(D==null){
                return F;
            }while(D!=null){
                var C=D[1].startsWith("[")?D[2].gsub("\\\\]","]"):D[1];B=B[C];if(null==B||""==D[3]){
                    break;
                }G=G.substring("["==D[3]?D[1].length:D[0].length);D=E.exec(G);
            }return F+String.interpret(B);
        }.bind(this));
    }
    });Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={};var Enumerable={
    each:function(C,B){
        var A=0;C=C.bind(B);try{
            this._each(function(E){
                C(E,A++);
            });
        }catch(D){
            if(D!=$break){
                throw D;
            }
            }return this;
    },
    eachSlice:function(D,C,B){
        C=C?C.bind(B):Prototype.K;var A=-D,E=[],F=this.toArray();while((A+=D)<F.length){
            E.push(F.slice(A,A+D));
        }return E.collect(C,B);
    },
    all:function(C,B){
        C=C?C.bind(B):Prototype.K;var A=true;this.each(function(E,D){
            A=A&&!!C(E,D);if(!A){
                throw $break;
            }
            });return A;
    },
    any:function(C,B){
        C=C?C.bind(B):Prototype.K;var A=false;this.each(function(E,D){
            if(A=!!C(E,D)){
                throw $break;
            }
            });return A;
    },
    collect:function(C,B){
        C=C?C.bind(B):Prototype.K;var A=[];this.each(function(E,D){
            A.push(C(E,D));
        });return A;
    },
    detect:function(C,B){
        C=C.bind(B);var A;this.each(function(E,D){
            if(C(E,D)){
                A=E;throw $break;
            }
            });return A;
    },
    findAll:function(C,B){
        C=C.bind(B);var A=[];this.each(function(E,D){
            if(C(E,D)){
                A.push(E);
            }
            });return A;
    },
    grep:function(D,C,B){
        C=C?C.bind(B):Prototype.K;var A=[];if(Object.isString(D)){
            D=new RegExp(D);
        }this.each(function(F,E){
            if(D.match(F)){
                A.push(C(F,E));
            }
            });return A;
    },
    include:function(A){
        if(Object.isFunction(this.indexOf)){
            if(this.indexOf(A)!=-1){
                return true;
            }
            }var B=false;this.each(function(C){
            if(C==A){
                B=true;throw $break;
            }
            });return B;
    },
    inGroupsOf:function(B,A){
        A=Object.isUndefined(A)?null:A;return this.eachSlice(B,function(C){
            while(C.length<B){
                C.push(A);
            }return C;
        });
    },
    inject:function(A,C,B){
        C=C.bind(B);this.each(function(E,D){
            A=C(A,E,D);
        });return A;
    },
    invoke:function(B){
        var A=$A(arguments).slice(1);return this.map(function(C){
            return C[B].apply(C,A);
        });
    },
    max:function(C,B){
        C=C?C.bind(B):Prototype.K;var A;this.each(function(E,D){
            E=C(E,D);if(A==null||E>=A){
                A=E;
            }
            });return A;
    },
    min:function(C,B){
        C=C?C.bind(B):Prototype.K;var A;this.each(function(E,D){
            E=C(E,D);if(A==null||E<A){
                A=E;
            }
            });return A;
    },
    partition:function(D,B){
        D=D?D.bind(B):Prototype.K;var C=[],A=[];this.each(function(F,E){
            (D(F,E)?C:A).push(F);
        });return[C,A];
    },
    pluck:function(B){
        var A=[];this.each(function(C){
            A.push(C[B]);
        });return A;
    },
    reject:function(C,B){
        C=C.bind(B);var A=[];this.each(function(E,D){
            if(!C(E,D)){
                A.push(E);
            }
            });return A;
    },
    sortBy:function(B,A){
        B=B.bind(A);return this.map(function(D,C){
            return{
                value:D,
                criteria:B(D,C)
                };
        }).sort(function(F,E){
            var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0;
        }).pluck("value");
    },
    toArray:function(){
        return this.map();
    },
    zip:function(){
        var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){
            B=A.pop();
        }var C=[this].concat(A).map($A);return this.map(function(E,D){
            return B(C.pluck(D));
        });
    },
    size:function(){
        return this.toArray().length;
    },
    inspect:function(){
        return"#<Enumerable:"+this.toArray().inspect()+">";
    }
    };Object.extend(Enumerable,{
    map:Enumerable.collect,
    find:Enumerable.detect,
    select:Enumerable.findAll,
    filter:Enumerable.findAll,
    member:Enumerable.include,
    entries:Enumerable.toArray,
    every:Enumerable.all,
    some:Enumerable.any
    });
function $A(C){
    if(!C){
        return[];
    }if(C.toArray){
        return C.toArray();
    }var B=C.length,A=new Array(B);while(B--){
        A[B]=C[B];
    }return A;
}if(Prototype.Browser.WebKit){
    function $A(C){
        if(!C){
            return[];
        }if(!(Object.isFunction(C)&&C=="[object NodeList]")&&C.toArray){
            return C.toArray();
        }var B=C.length,A=new Array(B);while(B--){
            A[B]=C[B];
        }return A;
    }
    }Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){
    Array.prototype._reverse=Array.prototype.reverse;
}Object.extend(Array.prototype,{
    _each:function(B){
        for(var A=0,C=this.length;A<C;A++){
            B(this[A]);
        }
        },
    clear:function(){
        this.length=0;return this;
    },
    first:function(){
        return this[0];
    },
    last:function(){
        return this[this.length-1];
    },
    compact:function(){
        return this.select(function(A){
            return A!=null;
        });
    },
    flatten:function(){
        return this.inject([],function(B,A){
            return B.concat(Object.isArray(A)?A.flatten():[A]);
        });
    },
    without:function(){
        var A=$A(arguments);return this.select(function(B){
            return !A.include(B);
        });
    },
    reverse:function(A){
        return(A!==false?this:this.toArray())._reverse();
    },
    reduce:function(){
        return this.length>1?this:this[0];
    },
    uniq:function(A){
        return this.inject([],function(D,C,B){
            if(0==B||(A?D.last()!=C:!D.include(C))){
                D.push(C);
            }return D;
        });
    },
    intersect:function(A){
        return this.uniq().findAll(function(B){
            return A.detect(function(C){
                return B===C;
            });
        });
    },
    clone:function(){
        return[].concat(this);
    },
    size:function(){
        return this.length;
    },
    inspect:function(){
        return"["+this.map(Object.inspect).join(", ")+"]";
    },
    toJSON:function(){
        var A=[];this.each(function(B){
            var C=Object.toJSON(B);if(!Object.isUndefined(C)){
                A.push(C);
            }
            });return"["+A.join(", ")+"]";
    }
    });if(Object.isFunction(Array.prototype.forEach)){
    Array.prototype._each=Array.prototype.forEach;
}if(!Array.prototype.indexOf){
    Array.prototype.indexOf=function(C,A){
        A||(A=0);var B=this.length;if(A<0){
            A=B+A;
        }for(;A<B;A++){
            if(this[A]===C){
                return A;
            }
            }return -1;
    };
}if(!Array.prototype.lastIndexOf){
    Array.prototype.lastIndexOf=function(B,A){
        A=isNaN(A)?this.length:(A<0?this.length+A:A)+1;var C=this.slice(0,A).reverse().indexOf(B);return(C<0)?C:A-C-1;
    };
}Array.prototype.toArray=Array.prototype.clone;function $w(A){
    if(!Object.isString(A)){
        return[];
    }A=A.strip();return A?A.split(/\s+/):[];
}if(Prototype.Browser.Opera){
    Array.prototype.concat=function(){
        var E=[];for(var B=0,C=this.length;B<C;B++){
            E.push(this[B]);
        }for(var B=0,C=arguments.length;B<C;B++){
            if(Object.isArray(arguments[B])){
                for(var A=0,D=arguments[B].length;A<D;A++){
                    E.push(arguments[B][A]);
                }
                }else{
                E.push(arguments[B]);
            }
            }return E;
    };
}
Object.extend(Number.prototype,{
    toColorPart:function(){
        return this.toPaddedString(2,16);
    },
    succ:function(){
        return this+1;
    },
    times:function(A){
        $R(0,this,true).each(A);return this;
    },
    toPaddedString:function(C,B){
        var A=this.toString(B||10);return"0".times(C-A.length)+A;
    },
    toJSON:function(){
        return isFinite(this)?this.toString():"null";
    }
    });$w("abs round ceil floor").each(function(A){
    Number.prototype[A]=Math[A].methodize();
});
function $H(A){
    return new Hashtable(A);
}var Hashtable=Class.create(Enumerable,(function(){
    function A(B,C){
        if(Object.isUndefined(C)){
            return B;
        }return B+"="+encodeURIComponent(String.interpret(C));
    }return{
        initialize:function(B){
            this._object=Object.isHash(B)?B.toObject():Object.clone(B);
        },
        _each:function(C){
            for(var B in this._object){
                var D=this._object[B],E=[B,D];E.key=B;E.value=D;C(E);
            }
            },
        set:function(B,C){
            return this._object[B]=C;
        },
        get:function(B){
            return this._object[B];
        },
        unset:function(B){
            var C=this._object[B];delete this._object[B];return C;
        },
        toObject:function(){
            return Object.clone(this._object);
        },
        keys:function(){
            return this.pluck("key");
        },
        values:function(){
            return this.pluck("value");
        },
        index:function(C){
            var B=this.detect(function(D){
                return D.value===C;
            });return B&&B.key;
        },
        merge:function(B){
            return this.clone().update(B);
        },
        update:function(B){
            return new Hashtable(B).inject(this,function(C,D){
                C.set(D.key,D.value);return C;
            });
        },
        toQueryString:function(){
            return this.map(function(D){
                var C=encodeURIComponent(D.key),B=D.value;if(B&&typeof B=="object"){
                    if(Object.isArray(B)){
                        return B.map(A.curry(C)).join("&");
                    }
                    }return A(C,B);
            }).join("&");
        },
        inspect:function(){
            return"#<Hash:{"+this.map(function(B){
                return B.map(Object.inspect).join(": ");
            }).join(", ")+"}>";
        },
        toJSON:function(){
            return Object.toJSON(this.toObject());
        },
        clone:function(){
            return new Hashtable(this);
        }
        };
})());Hashtable.prototype.toTemplateReplacements=Hashtable.prototype.toObject;Hashtable.from=$H;
var ObjectRange=Class.create(Enumerable,{
    initialize:function(C,A,B){
        this.start=C;this.end=A;this.exclusive=B;
    },
    _each:function(A){
        var B=this.start;while(this.include(B)){
            A(B);B=B.succ();
        }
        },
    include:function(A){
        if(A<this.start){
            return false;
        }if(this.exclusive){
            return A<this.end;
        }return A<=this.end;
    }
    });var $R=function(C,A,B){
    return new ObjectRange(C,A,B);
};
var Ice=new Object;
Object.methods=function(A){
    for(property in A){
        this.prototype[property]=A[property];
    }
    };Object.subclass=function(A){
    var B=function(){
        this.initialize.apply(this,arguments);
    };B.methods=this.methods;B.subclass=this.subclass;B.prototype.initialize=Function.NOOP;B.methods(this.prototype);B.prototype.initializeSuperclass=this.prototype.initialize?this.prototype.initialize:Function.NOOP;B.methods(A||{});return B;
};
Boolean.prototype.ifTrue=function(A){
    if(this==true){
        A();
    }return this;
};Boolean.prototype.ifFalse=function(A){
    if(this==false){
        A();
    }return this;
};
Number.prototype.asZeroPrefixedString=function(){
    return this<9?("0"+this):this.toString();
};Date.prototype.toTimestamp=function(){
    return this.toLocaleTimeString().substr(0,8);
};
Object.extend(String.prototype,{
    asBoolean:function(){
        return"true"==this||"yes"==this;
    },
    asNumber:function(){
        return this*1;
    },
    asElement:function(){
        return document.getElementById(this);
    },
    asExtendedElement:function(){
        var A=this.asElement();if(!A){
            throw"cannot find element with id: '"+this+"'";
        }return Ice.ElementModel.Element.adaptToElement(A);
    },
    asRegexp:function(){
        return new RegExp(this);
    },
    contains:function(A){
        return this.indexOf(A)>=0;
    },
    containsWords:function(){
        return/(\w+)/.test(this);
    }
    });
Object.extend(Array.prototype,{
    eachWithGuard:function(A){
        this.each(function(B){
            try{
                A(B);
            }catch(C){}
            });
    },
    intersect:function(A){
        return this.select(function(B){
            return A.include(B);
        });
    },
    complement:function(A){
        return this.reject(function(B){
            return A.include(B);
        });
    },
    isEmpty:function(){
        return this.length==0;
    },
    isNotEmpty:function(){
        return this.length>0;
    },
    as:function(A){
        A.apply(A,this);
    },
    copy:function(){
        return this.collect(function(A){
            return A;
        });
    },
    copyFrom:function(E,C){
        var D=[];var A=E+C;for(var B=E;B<A;B++){
            D.push(this[B]);
        }return D;
    },
    broadcast:function(A){
        this.each(function(B){
            B(A);
        });
    },
    broadcaster:function(){
        return function(A){
            this.broadcast(A);
        }.bind(this);
    },
    asSet:function(){
        var A=[];this.each(function(B){
            if(!A.include(B)){
                A.push(B);
            }
            });return A;
    }
    });
Function.prototype.delayFor=function(A){
    var B=this;return function(){
        var D=this;var E=arguments;var C=function(){
            try{
                B.apply(D,E);
            }finally{
                clearInterval(E.id);E.id=null;
            }
            };var F=E.id=setInterval(C,A);arguments.callee.cancel=function(){
            clearInterval(F);E.id=null;
        };
    };
};Function.prototype.delayExecutionFor=function(A){
    var B=this.delayFor(A);B.apply();return B;
};Function.prototype.repeatEvery=function(A){
    var B=this;return function(){
        var D=this;var E=arguments;var C=function(){
            B.apply(D,E);
        };var F=setInterval(C,A);arguments.callee.cancel=function(){
            clearInterval(F);
        };
    };
};Function.prototype.repeatExecutionEvery=function(A){
    var B=this.repeatEvery(A);B.apply(this);return B;
};Function.NOOP=function(){};
window.width=function(){
    return window.innerWidth?window.innerWidth:(document.documentElement&&document.documentElement.clientWidth)?document.documentElement.clientWidth:document.body.clientWidth;
};window.height=function(){
    return window.innerHeight?window.innerHeight:(document.documentElement&&document.documentElement.clientHeight)?document.documentElement.clientHeight:document.body.clientHeight;
};["onLoad","onUnload","onBeforeUnload","onResize","onScroll"].each(function(A){
    if(!window[A]){
        window[A]=function(D){
            var B=A.toLowerCase();var E=window[B];var C=E?[E,D]:[D];window[B]=C.broadcaster();window[A]=function(F){
                if(!C.detect(function(G){
                    return G.toString()==F.toString();
                })){
                    C.push(F);
                }
                };
        };
    }
    });if(typeof OpenAjax!="undefined"){
    if(typeof OpenAjax.addOnLoad!="undefined"){
        var current=window.onLoad;window.onLoad=OpenAjax.addOnLoad;OpenAjax.addOnLoad(current);
    }if(typeof OpenAjax.addOnUnLoad!="undefined"){
        var current=window.onUnload;window.onUnload=OpenAjax.addOnUnLoad;OpenAjax.addOnLoad(current);
    }
    }window.onKeyPress=function(A){
    var B=document.onkeypress;document.onkeypress=B?function(C){
        A(Ice.EventModel.Event.adaptToEvent(C));B(C);
    }:function(C){
        A(Ice.EventModel.Event.adaptToKeyEvent(C));
    };
};window.onKeyUp=function(A){
    var B=document.onkeyup;document.onkeyup=B?function(C){
        A(Ice.EventModel.Event.adaptToEvent(C));B(C);
    }:function(C){
        A(Ice.EventModel.Event.adaptToKeyEvent(C));
    };
};
[Ice].as(function(A){
    A.Enumerator=Object.subclass({
        initialize:function(B){
            this.indexedObject=B;
        },
        _each:function(C){
            var D=this.indexedObject.length;for(var B=0;B<D;B++){
                C(this.indexedObject[B],B);
            }
            },
        reverse:function(){
            return new A.ReverseEnumerator(this.indexedObject);
        }
        });A.Enumerator.methods(Enumerable);A.ReverseEnumerator=A.Enumerator.subclass({
        _each:function(C){
            var D=this.indexedObject.length-1;for(var B=D;B>=0;B--){
                C(this.indexedObject[B],B);
            }
            },
        reverse:function(){
            return new A.Enumerator(this.indexedObject);
        }
        });window.$enumerate=function(B){
        return new A.Enumerator(B);
    };
});
[Ice.Log=new Object].as(function(A){
    A.Priority=Object.subclass({
        debug:function(C,E,D,B){
            C.debug(E,D,B);
        },
        info:function(C,E,D,B){
            C.info(E,D,B);
        },
        warn:function(C,E,D,B){
            C.warn(E,D,B);
        },
        error:function(C,E,D,B){
            C.error(E,D,B);
        }
        });A.Debug=A.Priority.subclass({
        asString:function(){
            return"Debug";
        }
        });A.Info=A.Debug.subclass({
        debug:Function.NOOP,
        asString:function(){
            return"Info";
        }
        });A.Warn=A.Info.subclass({
        info:Function.NOOP,
        asString:function(){
            return"Warn";
        }
        });A.Error=A.Warn.subclass({
        warn:Function.NOOP,
        asString:function(){
            return"Error";
        }
        });A.Priority.DEBUG=new A.Debug;A.Priority.INFO=new A.Info;A.Priority.WARN=new A.Warn;A.Priority.ERROR=new A.Error;A.Priority.Levels=[A.Priority.DEBUG,A.Priority.INFO,A.Priority.WARN,A.Priority.ERROR];A.Logger=Object.subclass({
        initialize:function(D,C,B){
            this.handler=C||{
                debug:Function.NOOP,
                info:Function.NOOP,
                warn:Function.NOOP,
                error:Function.NOOP
                };this.category=D;this.children=[];this.priority=B||A.Priority.ERROR;
        },
        debug:function(C,B){
            this.priority.debug(this.handler,this.category,C,B);
        },
        info:function(C,B){
            this.priority.info(this.handler,this.category,C,B);
        },
        warn:function(C,B){
            this.priority.warn(this.handler,this.category,C,B);
        },
        error:function(C,B){
            this.priority.error(this.handler,this.category,C,B);
        },
        child:function(C){
            var B=this.category.copy();B.push(C);var D=new A.Logger(B,this.handler,this.priority);this.children.push(D);return D;
        },
        threshold:function(B){
            this.priority=B;this.children.each(function(C){
                C.threshold(B);
            });
        },
        handleWith:function(B){
            this.handler=B;
        }
        });A.WindowLogHandler=Object.subclass({
        initialize:function(D,E,B,C){
            this.lineOptions=[25,50,100,200,400];this.logger=D;this.logger.handleWith(this);this.parentWindow=E;this.lines=B||this.lineOptions[3];this.thresholdPriority=C||A.Priority.DEBUG;this.categoryMatcher=/.*/;this.closeOnExit=true;this.toggle();this.parentWindow.onKeyUp(function(G){
                var F=G.keyCode();if((F==20||F==84)&&(G.isCtrlPressed()||G.isAltPressed())&&G.isShiftPressed()){
                    this.enable();
                }
                }.bind(this));this.parentWindow.onUnload(function(){
                window.logger.info("page unloaded!");this.disable();
            }.bind(this));
        },
        enable:function(){
            try{
                this.window=this.parentWindow.open("","log"+window.identifier,"scrollbars=1,width=800,height=680");var D=this.window.document;this.log=this.window.document.getElementById("log-window");this.toggle();if(this.log){
                    return ;
                }D.body.appendChild(D.createTextNode(" Close on exit "));var I=D.createElement("input");I.style.margin="2px";I.setAttribute("type","checkbox");I.defaultChecked=true;I.checked=true;I.onclick=function(){
                    this.closeOnExit=I.checked;
                }.bind(this);D.body.appendChild(I);D.body.appendChild(D.createTextNode(" Lines "));var C=D.createElement("select");C.style.margin="2px";this.lineOptions.each(function(L,J){
                    var K=C.appendChild(D.createElement("option"));if(this.lines==L){
                        C.selectedIndex=J;
                    }K.appendChild(D.createTextNode(L.toString()));
                }.bind(this));C.onchange=function(J){
                    this.lines=this.lineOptions[C.selectedIndex];this.clearPreviousEvents();
                }.bind(this);D.body.appendChild(C);D.body.appendChild(D.createTextNode(" Category "));var H=D.createElement("input");H.style.margin="2px";H.setAttribute("type","text");H.setAttribute("value",this.categoryMatcher.source);H.onchange=function(){
                    this.categoryMatcher=H.value.asRegexp();
                }.bind(this);D.body.appendChild(H);D.body.appendChild(D.createTextNode(" Level "));var B=D.createElement("select");B.style.margin="2px";A.Priority.Levels.each(function(K,J){
                    var L=B.appendChild(D.createElement("option"));if(this.thresholdPriority==K){
                        B.selectedIndex=J;
                    }L.appendChild(D.createTextNode(K.asString()));
                }.bind(this));this.logger.threshold(this.thresholdPriority);B.onchange=function(J){
                    this.thresholdPriority=A.Priority.Levels[B.selectedIndex];this.logger.threshold(this.thresholdPriority);
                }.bind(this);D.body.appendChild(B);var F=D.createElement("input");F.style.margin="2px";F.setAttribute("type","button");F.setAttribute("value","Stop");F.onclick=function(){
                    F.setAttribute("value",this.toggle()?"Stop":"Start");
                }.bind(this);D.body.appendChild(F);var G=D.createElement("input");G.style.margin="2px";G.setAttribute("type","button");G.setAttribute("value","Clear");G.onclick=function(){
                    this.clearAllEvents();
                }.bind(this);D.body.appendChild(G);this.log=D.body.appendChild(D.createElement("pre"));this.log.id="log-window";this.log.style.width="100%";this.log.style.minHeight="0";this.log.style.maxHeight="550px";this.log.style.borderWidth="1px";this.log.style.borderStyle="solid";this.log.style.borderColor="#999";this.log.style.backgroundColor="#ddd";this.log.style.overflow="scroll";this.window.onunload=function(){
                    this.disable();
                }.bind(this);
            }catch(E){
                this.disable();
            }
            },
        disable:function(){
            this.logger.threshold(A.Priority.ERROR);this.handle=Function.NOOP;if(this.closeOnExit&&this.window){
                this.window.close();
            }
            },
        toggle:function(){
            if(this.handle==Function.NOOP){
                delete this.handle;return true;
            }else{
                this.handle=Function.NOOP;return false;
            }
            },
        debug:function(D,C,B){
            this.handle("#333","debug",D,C,B);
        },
        info:function(D,C,B){
            this.handle("green","info",D,C,B);
        },
        warn:function(D,C,B){
            this.handle("orange","warn",D,C,B);
        },
        error:function(D,C,B){
            this.handle("red","error",D,C,B);
        },
        handle:function(I,E,B,J,C){
            try{
                if(this.categoryMatcher.test(B.join("."))){
                    var F=this.log.ownerDocument;var H=(new Date()).toTimestamp();var D=B.join(".");("["+D+"] : "+J+(C?("\n"+C):"")).split("\n").each(function(K){
                        if(K.containsWords()){
                            var L=F.createElement("div");L.style.padding="3px";L.style.color=I;L.setAttribute("title",H+" | "+E);this.log.appendChild(L).appendChild(F.createTextNode(K));
                        }
                        }.bind(this));this.log.scrollTop=this.log.scrollHeight;
                }this.clearPreviousEvents();
            }catch(G){
                this.disable();
            }
            },
        clearPreviousEvents:function(){
            var B=$A(this.log.childNodes);B.copyFrom(0,B.length-this.lines).each(function(C){
                this.log.removeChild(C);
            }.bind(this));
        },
        clearAllEvents:function(){
            $A(this.log.childNodes).each(function(B){
                this.log.removeChild(B);
            }.bind(this));
        }
        });A.NOOPConsole={
        debug:Function.NOOP,
        info:Function.NOOP,
        warn:Function.NOOP,
        error:Function.NOOP
        };A.FirebugLogHandler=Object.subclass({
        initialize:function(B){
            B.handleWith(this);this.logger=B;this.console=A.NOOPConsole;this.enable();
        },
        enable:function(){
            this.console=window.console;this.logger.threshold(A.Priority.DEBUG);this.logger.warn("Firebug (version < 1.2) logging can cause increased memory consumption when running for a long period of time!");
        },
        disable:function(){
            this.console=A.NOOPConsole;this.logger.threshold(A.Priority.ERROR);
        },
        toggle:Function.NOOP,
        debug:function(D,C,B){
            B?this.console.debug(this.format(D,C),B):this.console.debug(this.format(D,C));
        },
        info:function(D,C,B){
            B?this.console.info(this.format(D,C),B):this.console.info(this.format(D,C));
        },
        warn:function(D,C,B){
            B?this.console.warn(this.format(D,C),B):this.console.warn(this.format(D,C));
        },
        error:function(D,C,B){
            B?this.console.error(this.format(D,C),B):this.console.error(this.format(D,C));
        },
        format:function(C,B){
            return"["+C.join(".")+"] "+B;
        }
        });
});
[Ice.Ajax=new Object].as(function(A){
    A.Client=Object.subclass({
        initialize:function(B){
            this.logger=B;this.cookies=new Object;document.cookie.split("; ").each(function(E){
                var D=E.split("=");this.cookies[D.first()]=D.last();
            }.bind(this));try{
                if(window.createRequest){
                    this.createRequest=function(){
                        var D=new A.RequestProxy(window.createRequest(),this.logger);D.post=function(E,H,F,G){
                            this.get(E,H,F,G);
                        };return D;
                    }.bind(this);
                }else{
                    if(window.XMLHttpRequest){
                        this.createRequest=function(){
                            return new A.RequestProxy(new XMLHttpRequest(),this.logger);
                        }.bind(this);
                    }else{
                        if(window.ActiveXObject){
                            this.createRequest=function(){
                                return new A.RequestProxy(new ActiveXObject("Microsoft.XMLHTTP"),this.logger);
                            }.bind(this);
                        }
                        }
                    }
                }catch(C){
                this.logger.error("failed to create factory request",C);
            }
            },
        getAsynchronously:function(D,B,C){
            return this.createRequest().getAsynchronously(D,B,C);
        },
        getSynchronously:function(D,B,C){
            return this.createRequest().getSynchronously(D,B,C);
        },
        postAsynchronously:function(D,B,C){
            return this.createRequest().postAsynchronously(D,B,C);
        },
        postSynchronously:function(D,B,C){
            return this.createRequest().postSynchronously(D,B,C);
        }
        });A.RequestProxy=Object.subclass({
        initialize:function(D,C){
            this.identifier=+Math.random().toString().substr(2,7);this.request=D;this.logger=C;this.callbacks=[];var B=this;this.responseCallback=function(){
                if(D.readyState==4){
                    B.logger.debug("["+B.identifier+"] : receive ["+B.statusCode()+"] "+B.statusText());var F=B.callbacks.length;for(var E=0;E<F;E++){
                        try{
                            B.callbacks[E](B);
                        }catch(G){
                            C.warn("connection closed prematurely",G);B.close();
                        }
                        }
                    }
                };
        },
        statusCode:function(){
            try{
                return this.request.status;
            }catch(B){
                return 0;
            }
            },
        statusText:function(){
            try{
                return this.request.statusText;
            }catch(B){
                return"";
            }
            },
        on:function(C,B){
            this.callbacks.push(function(D){
                if(C(D)){
                    B(D);
                }
                });
        },
        isServerError:function(){
            try{
                return this.request.status==500;
            }catch(B){
                return false;
            }
            },
        isEmpty:function(){
            try{
                return this.request.responseText=="";
            }catch(B){
                return true;
            }
            },
        getAsynchronously:function(D,B,C){
            this.request.open("GET",D+"?"+B+"&rand="+Math.random(),true);if(C){
                C(this);
            }this.request.onreadystatechange=this.responseCallback;this.logger.debug("["+this.identifier+"] : send asynchronous GET");this.request.send("");return this;
        },
        postAsynchronously:function(D,B,C){
            this.request.open("POST",D,true);if(C){
                C(this);
            }this.request.onreadystatechange=this.responseCallback;this.logger.debug("["+this.identifier+"] : send asynchronous POST");this.request.send(B+"&rand="+Math.random()+"\n\n");return this;
        },
        getSynchronously:function(D,B,C){
            this.request.open("GET",D+"?"+B+"&rand="+Math.random(),false);if(C){
                C(this);
            }this.logger.debug("["+this.identifier+"] : send synchronous GET");this.request.send("");this.responseCallback();return this;
        },
        postSynchronously:function(D,B,C){
            this.request.open("POST",D,false);if(C){
                C(this);
            }this.logger.debug("["+this.identifier+"] : send synchronous POST");this.request.send(B+"&rand="+Math.random()+"\n\n");this.responseCallback();return this;
        },
        setRequestHeader:function(B,C){
            this.request.setRequestHeader(B,C);
        },
        getResponseHeader:function(B){
            try{
                return this.request.getResponseHeader(B);
            }catch(C){
                return null;
            }
            },
        containsResponseHeader:function(B){
            try{
                var D=this.request.getResponseHeader(B);return D&&D!="";
            }catch(C){
                return false;
            }
            },
        content:function(){
            try{
                return this.request.responseText;
            }catch(B){
                return"";
            }
            },
        contentAsDOM:function(){
            return this.request.responseXML;
        },
        abort:function(){
            if(this.request){
                try{
                    this.request.onreadystatechange=Function.NOOP;this.request.abort();
                }catch(B){}finally{
                    this.request=null;this.logger.debug("["+this.identifier+"] : connection aborted");
                }
                }
            },
        close:function(){
            if(this.request){
                try{
                    this.request.onreadystatechange=Function.NOOP;
                }catch(B){}finally{
                    this.request=null;this.logger.debug("["+this.identifier+"] : connection closed");
                }
                }
            }
        });
});
[Ice.Parameter=new Object].as(function(A){
    A.Query=Object.subclass({
        initialize:function(){
            this.parameters=[];
        },
        add:function(B,C){
            this.parameters.push(new A.Association(B,C));return this;
        },
        addParameter:function(B){
            this.parameters.push(B);return this;
        },
        addQuery:function(B){
            B.serializeOn(this);return this;
        },
        asURIEncodedString:function(){
            return this.parameters.inject("",function(B,C,D){
                return B+=(D==0)?C.asURIEncodedString():"&"+C.asURIEncodedString();
            });
        },
        asString:function(){
            return this.parameters.inject("",function(B,D,C){
                return B+"\n| "+D.asString()+" |";
            });
        },
        sendOn:function(B){
            B.send(this);
        },
        serializeOn:function(B){
            this.parameters.each(function(C){
                C.serializeOn(B);
            });
        }
        });A.Query.create=function(C){
        var B=new A.Query;C.apply(this,[B]);return B;
    };A.Association=Object.subclass({
        initialize:function(B,C){
            this.name=B;this.value=C;
        },
        asURIEncodedString:function(){
            return encodeURIComponent(this.name)+"="+encodeURIComponent(this.value);
        },
        asString:function(){
            return this.name+"="+this.value;
        },
        serializeOn:function(B){
            B.add(this.name,this.value);
        }
        });
});
[Ice.Geometry=new Object].as(function(A){
    A.Point=Object.subclass({
        initialize:function(B,C){
            this.x=B;this.y=C;
        },
        asString:function(){
            return"point ["+this.x+", "+this.y+"]";
        },
        toString:function(){
            return this.asString();
        },
        serializeOn:function(B){
            B.add("ice.event.x",this.x);B.add("ice.event.y",this.y);
        }
        });
});
[Ice.ElementModel=new Object].as(function(This){
    This.TemporaryContainer=function(){
        var container=document.body.appendChild(document.createElement("div"));container.style.visibility="hidden";container.style.display="none";This.TemporaryContainer=function(){
            return container;
        };return container;
    };This.Update=Object.subclass({
        initialize:function(element){
            this.element=element;var tag=element.getAttribute("tag");this.startTag=function(html){
                html.push("<");html.push(tag);this.eachAttribute(function(name,value){
                    html.push(" ");html.push(name);html.push('="');html.push(value);html.push('"');
                });html.push(">");
            };this.endTag=function(html){
                html.push("</");html.push(tag);html.push(">");
            };
        },
        eachAttribute:function(iterator){
            $enumerate(this.element.getElementsByTagName("attribute")).each(function(attribute){
                var value=attribute.firstChild?attribute.firstChild.data:"";iterator(attribute.getAttribute("name"),value);
            });
        },
        content:function(){
            var contentElement=this.element.getElementsByTagName("content")[0];return contentElement.firstChild?contentElement.firstChild.data.replace(/<\!\#cdata\#/g,"<![CDATA[").replace(/\#\#>/g,"]]>"):"";
        },
        asHTML:function(){
            var html=[];this.startTag(html);html.push(this.content());this.endTag(html);return html.join("");
        },
        asString:function(){
            var html=[];this.startTag(html);html.push("...");this.endTag(html);return html.join("");
        }
        });This.Element=Object.subclass({
        MouseListenerNames:["onClick","onDblClick","onMouseDown","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],
        KeyListenerNames:["onKeyDown","onKeyPress","onKeyUp","onHelp"],
        initialize:function(element){
            this.element=element;
        },
        id:function(){
            return this.element.id;
        },
        isSubmit:function(){
            return false;
        },
        form:function(){
            var parent=this.element.parentNode;while(parent){
                if(parent.tagName&&parent.tagName.toLowerCase()=="form"){
                    return This.Element.adaptToElement(parent);
                }parent=parent.parentNode;
            }throw"Cannot find enclosing form.";
        },
        updateDOM:function(update){
            this.replaceHtml(update.asHTML());
        },
        replaceHtml:function(html){
            this.withTemporaryContainer(function(container){
                container.innerHTML=html;var newElement=container.firstChild;this.disconnectEventListeners();this.replaceHostElementWith(newElement);
            });
        },
        disconnectEventListeners:function(){
            if(this.element.bridge){
                this.element.bridge.dispose();
            }var elements=this.element.getElementsByTagName("*");var length=elements.length;for(var i=0;i<length;i++){
                var element=elements[i];$element(element).eachListenerName(function(listenerName){
                    element[listenerName.toLowerCase()]=null;
                });
            }
            },
        serializeOn:function(query){},
        sendOn:function(connection){
            Query.create(function(query){
                this.serializeOn(query);
            }.bind(this)).sendOn(connection);
        },
        send:function(){
            this.sendOn(connection);
        },
        withTemporaryContainer:function(execute){
            try{
                execute.apply(this,[This.TemporaryContainer()]);
            }finally{
                This.TemporaryContainer().innerHTML="";
            }
            },
        defaultReplaceHostElementWith:function(newElement){
            this.displayOff();this.element.parentNode.replaceChild(newElement,this.element);this.element=newElement;
        },
        replaceHostElementWith:function(newElement){
            this.defaultReplaceHostElementWith(newElement);
        },
        displayOff:/Safari/.test(navigator.userAgent)?Function.NOOP:function(){
            this.element.style.display="none";
        },
        eachListenerName:function(iterator){
            this.MouseListenerNames.each(iterator);this.KeyListenerNames.each(iterator);
        },
        findBridge:function(){
            return this.findContainerFor("bridge").bridge;
        },
        findConnection:function(){
            return this.findBridge().connection;
        },
        findContainerFor:function(property){
            var parent=this.element;while(parent){
                if(parent[property]){
                    return parent;
                }else{
                    parent=parent.parentNode;
                }
                }throw"couldn't find container for property: "+property;
        }
        });This.Element.adaptToElement=function(e){
        if(!e){
            return new This.Element(e);
        }switch(e.tagName.toLowerCase()){
            case"textarea":case"input":return new This.InputElement(e);case"th":case"td":case"tr":return new This.TableCellElement(e);case"button":return new This.ButtonElement(e);case"select":return new This.SelectElement(e);case"form":return new This.FormElement(e);case"body":return new This.BodyElement(e);case"script":return new This.ScriptElement(e);case"title":return new This.TitleElement(e);case"a":return new This.AnchorElement(e);case"iframe":return new This.IFrameElement(e);default:return new This.Element(e);
        }
        };This.ElementStyleProperties=["background","backgroundAttachment","backgroundColor","backgroundImage","backgroundPosition","backgroundRepeat","border","borderBottom","borderBottomColor","borderBottomStyle","borderBottomWidth","borderColor","borderLeft","borderLeftColor","borderLeftStyle","borderLeftWidth","borderRight","borderRightColor","borderRightStyle","borderRightWidth","borderStyle","borderTop","borderTopColor","borderTopStyle","borderTopWidth","borderWidth","clear","clip","color","cursor","display","filter","font","fontFamily","fontSize","fontVariant","fontWeight","height","left","letterSpacing","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginBottom","marginLeft","marginRight","marginTop","overflow","padding","paddingBottom","paddingLeft","paddingRight","paddingTop","pageBreakAfter","pageBreakBefore","position","styleFloat","textAlign","textDecoration","textDecorationBlink","textDecorationLineThrough","textDecorationNone","textDecorationOverline","textDecorationUnderline","textIndent","textTransform","top","verticalAlign","visibility","width","zIndex"];This.InputElementAttributes=["className","title","lang","name","value","checked","disabled","readOnly","size","maxLength","src","alt","useMap","isMap","tabIndex","accessKey","accept"];This.InputElement=This.Element.subclass({
        InputListenerNames:["onBlur","onFocus","onChange"],
        initialize:function(element){
            this.element=element;var type=element.type.toLowerCase();this.isSubmitElement=type=="submit"||type=="image"||type=="button";
        },
        isSubmit:function(){
            return this.isSubmitElement;
        },
        form:function(){
            return This.Element.adaptToElement(this.element.form);
        },
        focus:function(){
            var onFocusListener=this.element.onfocus;this.element.onfocus=Function.NOOP;this.element.focus();this.element.onfocus=onFocusListener;
        },
        replaceHostElementWith:function(newElement){
            This.InputElementAttributes.each(function(attributeName){
                var newValue=newElement[attributeName];var oldValue=this.element[attributeName];if(oldValue!=newValue){
                    this.element[attributeName]=newValue;
                }
                }.bind(this));var newStyle=newElement.getAttribute("style");var oldStyle=this.element.getAttribute("style");var elementStyle=this.element.style;var newElementStyle=newElement.style;if(newStyle!=oldStyle){
                this.element.setAttribute("style",newStyle);This.ElementStyleProperties.each(function(p){
                    elementStyle[p]=newElementStyle[p];
                });
            }this.eachListenerName(function(listenerName){
                var name=listenerName.toLowerCase();this.element[name]=newElement[name]?newElement[name].bind(this.element):null;newElement[name]=null;
            }.bind(this));
        },
        serializeOn:function(query){
            switch(this.element.type.toLowerCase()){
                case"image":case"textarea":case"submit":case"hidden":case"password":case"text":query.add(this.element.name,this.element.value);break;case"checkbox":case"radio":if(this.element.checked){
                    query.add(this.element.name,this.element.value||"on");
                }break;
            }
            },
        eachListenerName:function(iterator){
            this.MouseListenerNames.each(iterator);this.KeyListenerNames.each(iterator);this.InputListenerNames.each(iterator);
        }
        });This.SelectElement=This.InputElement.subclass({
        isSubmit:function(){
            return false;
        },
        replaceHostElementWith:function(newElement){
            this.defaultReplaceHostElementWith(newElement);
        },
        serializeOn:function(query){
            $enumerate(this.element.options).select(function(option){
                return option.selected;
            }).each(function(selectedOption){
                var value=selectedOption.value||(selectedOption.value==""?"":selectedOption.text);query.add(this.element.name,value);
            }.bind(this));
        }
        });This.ButtonElement=This.InputElement.subclass({
        initialize:function(element){
            this.element=element;this.isSubmitElement=element.type.toLowerCase()=="submit";
        },
        isSubmit:function(){
            return this.isSubmitElement;
        },
        replaceHostElementWith:function(newElement){
            this.defaultReplaceHostElementWith(newElement);
        },
        serializeOn:function(query){
            query.add(this.element.name,this.element.value);
        }
        });This.FormElement=This.Element.subclass({
        FormListenerNames:["onReset","onSubmit","submit"],
        FormAttributeNames:["acceptcharset","action","enctype","method","name","target"],
        detectDefaultSubmit:function(){
            var formElements=this.element.elements;var length=formElements.length;var defaultID=this.element.id+":default";for(var i=0;i<length;i++){
                var formElement=formElements[i];if(formElement.id==defaultID){
                    return This.Element.adaptToElement(formElement);
                }
                }return null;
        },
        eachFormElement:/Safari/.test(navigator.userAgent)?function(iterator){
            var newestElements=[];$enumerate(this.element.elements).reverse().each(function(element){
                if(!newestElements.detect(function(newestElement){
                    return element.id&&newestElement.id&&newestElement.id==element.id;
                })){
                    newestElements.push(element);iterator(This.Element.adaptToElement(element));
                }
                });
        }:function(iterator){
            $enumerate(this.element.elements).each(function(e){
                iterator(This.Element.adaptToElement(e));
            });
        },
        captureOnSubmit:function(){
            var previousOnSubmit=this.element.onsubmit;this.element.onsubmit=function(event){
                if(previousOnSubmit){
                    previousOnSubmit();
                }$event(event).cancelDefaultAction();iceSubmit(this,null,event);
            };
        },
        redirectSubmit:function(){
            this.element.submit=function(){
                iceSubmit(this,null,null);
            };
        },
        captureAndRedirectSubmit:function(){
            this.captureOnSubmit();this.redirectSubmit();
        },
        updateDOM:function(update){
            this.disconnectEventListeners();this.element.innerHTML=update.content();var remove=function(name){
                this.element[name]=null;
            }.bind(this);this.FormAttributeNames.each(function(name){
                this.element.removeAttribute(name);
            }.bind(this));this.eachListenerName(remove);update.eachAttribute(function(name,value){
                try{
                    this.element.setAttribute(name,value);
                }catch(e){
                    logger.error("failed to set attribute "+name+":"+value,e);
                }
                }.bind(this));
        },
        serializeOn:function(query){
            this.eachFormElement(function(formElement){
                if(!formElement.isSubmit()){
                    formElement.serializeOn(query);
                }
                });
        },
        eachListenerName:function(iterator){
            this.MouseListenerNames.each(iterator);this.KeyListenerNames.each(iterator);this.FormListenerNames.each(iterator);
        },
        submit:function(){
            iceSubmit(this.element,null,null);
        }
        });This.BodyElement=This.Element.subclass({
        replaceHtml:function(html){
            this.disconnectEventListeners();var start=new RegExp("<noscript>","g").exec(html);if(start==null){
                this.element.innerHTML=html;
            }else{
                var end=new RegExp("</noscript>","g").exec(html);this.element.innerHTML=html.substring(0,start.index)+html.substring(end.index+11,html.length);
            }
            }
        });This.ScriptElement=This.Element.subclass({
        updateDOM:function(update){
            var scriptCode=update.content();if(scriptCode!=""&&scriptCode!=";"){
                var evalFunc=function(){
                    eval(scriptCode);
                };evalFunc.apply(window);
            }
            }
        });This.TitleElement=This.Element.subclass({
        updateDOM:function(update){
            this.element.ownerDocument.title=update.content();
        }
        });This.AnchorElement=This.Element.subclass({
        isSubmit:function(){
            return true;
        },
        focus:function(){
            var onFocusListener=this.element.onfocus;this.element.onfocus=Function.NOOP;this.element.focus();this.element.onfocus=onFocusListener;
        },
        serializeOn:function(query){
            if(this.element.name){
                query.add(this.element.name,this.element.name);
            }
            }
        });This.TableCellElement=This.Element.subclass({
        replaceHtml:function(html){
            this.withTemporaryContainer(function(container){
                container.innerHTML="<TABLE>"+html+"</TABLE>";var newElement=container.firstChild;while((null!=newElement)&&(this.element.id!=newElement.id)){
                    newElement=newElement.firstChild;
                }this.disconnectEventListeners();this.replaceHostElementWith(newElement);
            });
        }
        });This.IFrameElement=This.Element.subclass({
        replaceHostElementWith:function(newElement){
            this.eachAttributeName(function(attributeName){
                var value=newElement.getAttribute(attributeName);if(value==null){
                    this.element.removeAttribute(attributeName);
                }else{
                    this.element.setAttribute(attributeName,value);
                }
                }.bind(this));var oldLocation=this.element.contentWindow.location.href;var newLocation=newElement.contentWindow.location.href;if(oldLocation!=newLocation){
                this.element.contentWindow.location=newLocation;
            }this.eachListenerName(function(listenerName){
                var name=listenerName.toLowerCase();this.element[name]=newElement[name]?newElement[name].bind(this.element):null;newElement[name]=null;
            }.bind(this));
        },
        eachAttributeName:function(iterator){
            ["title","lang","dir","class","style","align","frameborder","width","height","hspace","ismap","longdesc","marginwidth","marginheight","name","scrolling"].each(iterator);
        }
        });window.$element=This.Element.adaptToElement;
});
[Ice.EventModel=new Object,Ice.ElementModel.Element,Ice.Parameter.Query,Ice.Geometry].as(function(E,B,A,G){
    E.IE=new Object;E.Netscape=new Object;E.Event=Object.subclass({
        initialize:function(I,H){
            this.event=I;this.currentElement=H;
        },
        cancel:function(){
            this.cancelBubbling();this.cancelDefaultAction();
        },
        isKeyEvent:function(){
            return false;
        },
        isMouseEvent:function(){
            return false;
        },
        captured:function(){
            return this.currentElement?B.adaptToElement(this.currentElement):null;
        },
        serializeEventOn:function(H){
            H.add("ice.event.target",this.target()&&this.target().id());H.add("ice.event.captured",this.captured()&&this.captured().id());H.add("ice.event.type","on"+this.event.type);
        },
        serializeOn:function(H){
            this.serializeEventOn(H);
        },
        sendOn:function(H){
            A.create(function(I){
                I.add("ice.submit.partial",false);try{
                    this.captured().serializeOn(I);this.serializeOn(I);
                }catch(J){
                    this.serializeOn(I);
                }
                }.bind(this)).sendOn(H);
        },
        sendFullOn:function(H){
            A.create(function(I){
                I.add("ice.submit.partial",false);try{
                    this.captured().serializeOn(I);this.form().serializeOn(I);this.serializeOn(I);
                }catch(J){
                    this.serializeOn(I);
                }
                }.bind(this)).sendOn(H);
        },
        sendWithCondition:function(H){
            if(H(this)){
                this.send();
            }
            },
        send:function(){
            this.cancel();this.sendOn(this.captured().findConnection());
        },
        sendFull:function(){
            this.cancel();this.sendFullOn(this.captured().findConnection());
        }
        });E.IE.Event=E.Event.subclass({
        target:function(){
            return this.event.srcElement?B.adaptToElement(this.event.srcElement):null;
        },
        cancelBubbling:function(){
            this.event.cancelBubble=true;
        },
        cancelDefaultAction:function(){
            this.event.returnValue=false;
        }
        });E.Netscape.Event=E.Event.subclass({
        target:function(){
            if(window.blackberry){
                return this.event.currentTarget?B.adaptToElement(this.event.currentTarget):null;
            }return this.event.target?B.adaptToElement(this.event.target):null;
        },
        cancelBubbling:function(){
            this.event.stopPropagation();
        },
        cancelDefaultAction:function(){
            this.event.preventDefault();
        }
        });var F={
        isAltPressed:function(){
            return this.event.altKey;
        },
        isCtrlPressed:function(){
            return this.event.ctrlKey;
        },
        isShiftPressed:function(){
            return this.event.shiftKey;
        },
        isMetaPressed:function(){
            return this.event.metaKey;
        },
        serializeKeyAndMouseEventOn:function(H){
            H.add("ice.event.alt",this.isAltPressed());H.add("ice.event.ctrl",this.isCtrlPressed());H.add("ice.event.shift",this.isShiftPressed());H.add("ice.event.meta",this.isMetaPressed());
        }
        };var D={
        isMouseEvent:function(){
            return true;
        },
        serializeOn:function(H){
            this.serializeEventOn(H);this.serializeKeyAndMouseEventOn(H);this.pointer().serializeOn(H);H.add("ice.event.left",this.isLeftButton());H.add("ice.event.right",this.isRightButton());
        }
        };E.IE.MouseEvent=E.IE.Event.subclass({
        pointer:function(){
            return new G.Point(this.event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft),this.event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
        },
        isLeftButton:function(){
            return this.event.button==1;
        },
        isRightButton:function(){
            return this.event.button==2;
        }
        });E.IE.MouseEvent.methods(F);E.IE.MouseEvent.methods(D);E.Netscape.MouseEvent=E.Netscape.Event.subclass({
        pointer:function(){
            return new G.Point(this.event.pageX,this.event.pageY);
        },
        isLeftButton:function(){
            return this.event.which==1;
        },
        isRightButton:function(){
            return this.event.which==3;
        }
        });E.Netscape.MouseEvent.methods(F);E.Netscape.MouseEvent.methods(D);var C={
        keyCharacter:function(){
            return String.fromCharCode(this.keyCode());
        },
        isEnterKey:function(){
            return this.keyCode()==13;
        },
        isEscKey:function(){
            return this.keyCode()==27;
        },
        isBackspaceKey:function(){
            return this.keyCode()==8;
        },
        isDeleteKey:function(){
            return this.keyCode()==46||this.keyCode()==63272;
        },
        isSpaceKey:function(){
            return this.keyCode()==32;
        },
        isTabKey:function(){
            return this.keyCode()==9||(this.isShiftPressed()&&this.keyCode()==25);
        },
        isHomeKey:function(){
            return this.keyCode()==36||this.keyCode()==63273;
        },
        isEndKey:function(){
            return this.keyCode()==35||this.keyCode()==63275;
        },
        isPageUpKey:function(){
            return this.keyCode()==33||this.keyCode()==63276;
        },
        isPageDownKey:function(){
            return this.keyCode()==34||this.keyCode()==63277;
        },
        isArrowUpKey:function(){
            return this.keyCode()==38||this.keyCode()==63232;
        },
        isArrowDownKey:function(){
            return this.keyCode()==40||this.keyCode()==63233;
        },
        isArrowLeftKey:function(){
            return this.keyCode()==37||this.keyCode()==63234;
        },
        isArrowRightKey:function(){
            return this.keyCode()==39||this.keyCode()==63235;
        },
        isKeyEvent:function(){
            return true;
        },
        serializeOn:function(H){
            this.serializeEventOn(H);this.serializeKeyAndMouseEventOn(H);H.add("ice.event.keycode",this.keyCode());
        }
        };E.IE.KeyEvent=E.IE.Event.subclass({
        keyCode:function(){
            return this.event.keyCode;
        }
        });E.IE.KeyEvent.methods(F);E.IE.KeyEvent.methods(C);E.Netscape.KeyEvent=E.Netscape.Event.subclass({
        keyCode:function(){
            return this.event.which==0?this.event.keyCode:this.event.which;
        }
        });E.Netscape.KeyEvent.methods(F);E.Netscape.KeyEvent.methods(C);E.UnknownEvent=E.Event.subclass({
        initialize:function(H){
            this.currentElement=H;
        },
        target:function(){
            return this.currentElement==null?null:B.adaptToElement(this.currentElement);
        },
        serializeEventOn:function(H){
            H.add("ice.event.target",this.target()&&this.target().id());H.add("ice.event.captured",this.captured()&&this.captured().id());H.add("ice.event.type","unknown");
        },
        cancelBubbling:Function.NOOP,
        cancelDefaultAction:Function.NOOP
        });E.Event.adaptToPlainEvent=function(I,H){
        return window.event?new E.IE.Event(event,H):new E.Netscape.Event(I,H);
    };E.Event.adaptToMouseEvent=function(I,H){
        return window.event?new E.IE.MouseEvent(event,H):new E.Netscape.MouseEvent(I,H);
    };E.Event.adaptToKeyEvent=function(I,H){
        return window.event?new E.IE.KeyEvent(event,H):new E.Netscape.KeyEvent(I,H);
    };E.Event.adaptToEvent=function(K,H){
        var J=window.event||K;if(J){
            var I="on"+J.type;var L=function(M){
                return M.toLowerCase()==I;
            };if(B.prototype.KeyListenerNames.detect(L)){
                return E.Event.adaptToKeyEvent(K,H);
            }else{
                if(B.prototype.MouseListenerNames.detect(L)){
                    return E.Event.adaptToMouseEvent(K,H);
                }else{
                    return E.Event.adaptToPlainEvent(K,H);
                }
                }
            }else{
            return new E.UnknownEvent(H);
        }
        };window.$event=E.Event.adaptToEvent;
});
[Ice].as(function(A){
    A.Cookie=A.Parameter.Association.subclass({
        initialize:function(B,C,D){
            this.name=B;this.value=C||"";this.path=D||"/";this.save();
        },
        saveValue:function(B){
            this.value=B;this.save();
        },
        loadValue:function(){
            this.load();return this.value;
        },
        save:function(){
            document.cookie=this.name+"="+this.value+"; path="+this.path;return this;
        },
        load:function(){
            var B=A.Cookie.parse().detect(function(C){
                return this.name==C[0];
            }.bind(this));this.value=B?B[1]:null;return this;
        },
        remove:function(){
            var B=new Date();B.setTime(B.getTime()-24*60*60*1000);document.cookie=this.name+"=; expires="+B.toGMTString()+"; path="+this.path;
        }
        });A.Cookie.all=function(){
        return A.Cookie.parse().collect(function(B){
            var C=B[0];var D=B[1];return new A.Cookie(C,D);
        });
    };A.Cookie.lookup=function(B,D){
        var C=A.Cookie.parse().detect(function(E){
            return B==E[0];
        });if(C){
            return new A.Cookie(B,C[1]);
        }else{
            if(D){
                return new A.Cookie(B,D);
            }else{
                throw"Cannot find cookie named: "+B;
            }
            }
        };A.Cookie.exists=function(B){
        return document.cookie.contains(B+"=");
    };A.Cookie.parse=function(){
        return document.cookie.split("; ").collect(function(B){
            return B.contains("=")?B.split("="):[B,""];
        });
    };
});
function currentConnection(){
    var A=$enumerate(arguments).detect(function(B){
        return !!B;
    });return A.findConnection();
}function formOf(A){
    var B=A.parentNode;while(B){
        if(B.tagName&&B.tagName.toLowerCase()=="form"){
            return B;
        }B=B.parentNode;
    }throw"Cannot find enclosing form.";
}function iceSubmitPartial(C,B,A){
    C=(C?C:B.form);var D=new Ice.Parameter.Query();if(Ice.InputFileIdPreUpload){
        D.add("ice.inputFile.preUpload",Ice.InputFileIdPreUpload);
    }if(Ice.InputFileIdPostUpload){
        D.add("ice.inputFile.postUpload",Ice.InputFileIdPostUpload);
    }if(Ice.Menu!=null&&Ice.Menu.menuContext!=null){
        D.add("ice.menuContext",Ice.Menu.menuContext);
    }if(Ice.FCKeditorUtility){
        Ice.FCKeditorUtility.saveAll();
    }D.add("ice.submit.partial",true);$event(A,B).serializeOn(D);if(C&&C.id){
        $element(C).serializeOn(D);
    }if(B&&B.id){
        var E=$element(B);if(E.isSubmit()){
            E.serializeOn(D);
        }
        }D.sendOn(currentConnection($element(C),$element(B)));resetHiddenFieldsFor(C);return false;
}function iceSubmit(B,D,A){
    B=(B?B:D.form);var F=$event(A,D);var E=$element(B);var H=new Ice.Parameter.Query();if(Ice.InputFileIdPreUpload){
        H.add("ice.inputFile.preUpload",Ice.InputFileIdPreUpload);
    }if(Ice.InputFileIdPostUpload){
        H.add("ice.inputFile.postUpload",Ice.InputFileIdPostUpload);
    }if(Ice.Menu!=null&&Ice.Menu.menuContext!=null){
        H.add("ice.menuContext",Ice.Menu.menuContext);
    }if(Ice.FCKeditorUtility){
        Ice.FCKeditorUtility.saveAll();
    }H.add("ice.submit.partial",false);if(F.isKeyEvent()){
        if(F.isEnterKey()){
            var G=E?E.detectDefaultSubmit():null;F.cancelDefaultAction();F.serializeOn(H);if(G){
                G.serializeOn(H);
            }if(E){
                E.serializeOn(H);
            }H.sendOn(currentConnection($element(B),$element(D)));
        }
        }else{
        var C=D&&D.id?$element(D):null;F.serializeOn(H);if(C&&C.isSubmit()){
            C.serializeOn(H);
        }if(E){
            E.serializeOn(H);
        }H.sendOn(currentConnection($element(B),$element(D)));
    }resetHiddenFieldsFor(B);return false;
}function resetHiddenFieldsFor(A){
    $enumerate(A.elements).each(function(B){
        if(B.type=="hidden"&&B.id==""){
            B.value="";
        }
        });
}
[Ice.Document=new Object,Ice.ElementModel.Element,Ice.Connection,Ice.Ajax].as(function(D,A,C,B){
    D.replaceContainerHTML=function(H,I){
        var L=new RegExp("<body[^<]*>","g").exec(I);var G=new RegExp("</body>","g").exec(I);var F=I.substring(L.index,G.index+G[0].length);var K=F.substring(F.indexOf(">")+1,F.lastIndexOf("<"));var E=H.tagName;var J=$element(H);J.disconnectEventListeners();J.replaceHtml(["<",E,">",K,"</",E,">"].join(""));
    };D.Synchronizer=Object.subclass({
        initialize:function(E,G,I){
            this.logger=E.child("synchronizer");this.ajax=new B.Client(this.logger);var H="history-frame:"+G+":"+I;try{
                window.frames[H].location.hash;this.historyFrame=window.frames[H];
            }catch(F){
                this.historyFrame=H.asElement().contentWindow;
            }try{
                if(this.historyFrame.location.hash.length>0){
                    this.reload();
                }
                }catch(F){
                this.logger.error("History frame reload failed: "+F);
            }
            },
        synchronize:function(){
            this.synchronize=Function.NOOP;try{
                if(!this.historyFrame.location.hash.contains("reload")){
                    this.historyFrame.location.replace(this.historyFrame.location+"#reload");this.logger.debug("mark document as modified");
                }
                }catch(E){
                this.logger.warn("could not mark document as modified",E);
            }
            },
        reload:function(){
            try{
                this.logger.info("synchronize body");this.ajax.getAsynchronously(document.URL,"",function(F){
                    F.setRequestHeader("Connection","close");F.on(C.OK,function(G){
                        D.replaceContainerHTML(document.body,G.content());
                    });
                });
            }catch(E){
                this.logger.error("failed to reload body",E);
            }
            },
        shutdown:function(){
            this.synchronize=Function.NOOP;
        }
        });
});
[Ice.Command=new Object].as(function(A){
    A.Dispatcher=Object.subclass({
        initialize:function(){
            this.commands=new Object;
        },
        register:function(B,C){
            this.commands[B]=C;
        },
        deserializeAndExecute:function(D){
            var B=D.tagName;for(var C in this.commands){
                if(C==B){
                    this.commands[B](D);return ;
                }
                }throw"Unknown message received: "+B;
        }
        });A.SetCookie=function(B){
        document.cookie=B.firstChild.data;
    };A.ParsingError=function(C){
        logger.error("Parsing error");var D=C.firstChild;logger.error(D.data);var B=D.firstChild;logger.error(B.data);
    };
});
[Ice.Script=new Object,Ice.Ajax.Client].as(function(This,Client){
    This.Loader=Object.subclass({
        initialize:function(logger){
            this.logger=logger.child("script-loader");this.referencedScripts=[];this.client=new Client(this.logger);$enumerate(document.documentElement.getElementsByTagName("script")).each(function(script){
                if(script.src){
                    this.referencedScripts.push(script.src);
                }
                }.bind(this));
        },
        searchAndEvaluateScripts:function(element){
            $enumerate(element.getElementsByTagName("script")).each(function(s){
                this.evaluateScript(s);
            }.bind(this));
        },
        evaluateScript:function(script){
            var uri=script.src;if(uri){
                if(!this.referencedScripts.include(script.src)){
                    this.logger.debug("loading : "+uri);this.client.getSynchronously(uri,"",function(request){
                        request.on(Ice.Connection.OK,function(){
                            this.referencedScripts.push(uri);this.logger.debug("evaluating script at : "+uri);try{
                                eval(request.content());
                            }catch(e){
                                this.logger.warn("Failed to evaluate script located at: "+uri,e);
                            }
                            }.bind(this));
                    }.bind(this));
                }
                }else{
                var code=script.innerHTML;this.logger.debug("evaluating script : "+code);try{
                    eval(code);
                }catch(e){
                    this.logger.warn("Failed to evaluate script: \n"+code,e);
                }
                }
            }
        });
});
var currentFocus;function setFocus(A){
    currentFocus=A;
}[Ice.Focus=new Object].as(function(D){
    function C(E){
        return/^\w[\w\-\:]*$/.test(E);
    }D.setFocus=(function(F){
        if(F&&C(F)){
            try{
                F.asExtendedElement().focus();setFocus(F);var E=document.getElementById(F);if(E){
                    E.focus();
                }else{
                    logger.info("Cannot set focus, no element for id ["+F+"]");
                }logger.debug("Focus Set on ["+F+"]");
            }catch(E){
                logger.info("Cannot set focus, no element for id ["+F+"]",E);
            }
            }else{
            logger.debug("Focus interupted. Not Set on ["+F+"]");
        }
        }).delayFor(100);function B(F,E,G){
        var H=F[E];if(H){
            F[E]=function(J){
                var I=[J];H.apply(F,I);G.apply(F,I);
            };
        }else{
            F[E]=G;
        }
        }function A(G){
        var E=G||window.event;var F=E.srcElement||E.target;setFocus(F.id);
    }D.captureFocusIn=function(E){
        $enumerate(["select","input","button","a"]).each(function(F){
            $enumerate(E.getElementsByTagName(F)).each(function(G){
                B(G,"onfocus",A);
            });
        });
    };window.onLoad(function(){
        D.captureFocusIn(document);
    });
});
[Ice.Status=new Object].as(function(A){
    A.NOOPIndicator={
        on:Function.NOOP,
        off:Function.NOOP
        };A.RedirectIndicator=Object.subclass({
        initialize:function(B){
            this.uri=B;
        },
        on:function(){
            window.location.href=this.uri;
        },
        off:Function.NOOP
        });A.ElementIndicator=Object.subclass({
        initialize:function(B,C){
            this.elementID=B;this.indicators=C;this.indicators.push(this);this.off();
        },
        on:function(){
            this.indicators.each(function(C){
                if(C!=this){
                    C.off();
                }
                }.bind(this));var B=this.elementID.asElement();if(B){
                B.style.visibility="visible";
            }
            },
        off:function(){
            var B=this.elementID.asElement();if(B){
                B.style.visibility="hidden";
            }
            }
        });A.OverlappingStateProtector=Object.subclass({
        initialize:function(B){
            this.indicator=B;this.counter=0;
        },
        on:function(){
            if(this.counter==0){
                this.indicator.on();
            }++this.counter;
        },
        off:function(){
            if(this.counter<1){
                return ;
            }if(this.counter==1){
                this.indicator.off();
            }--this.counter;
        }
        });A.ToggleIndicator=Object.subclass({
        initialize:function(B,C){
            this.onElement=B;this.offElement=C;this.off();
        },
        on:function(){
            this.onElement.on();this.offElement.off();
        },
        off:function(){
            this.onElement.off();this.offElement.on();
        }
        });A.MuxIndicator=Object.subclass({
        initialize:function(){
            this.indicators=arguments;this.off();
        },
        on:function(){
            $enumerate(this.indicators).each(function(B){
                B.on();
            });
        },
        off:function(){
            $enumerate(this.indicators).each(function(B){
                B.off();
            });
        }
        });A.PointerIndicator=Object.subclass({
        initialize:function(B){
            this.toggle=function(){
                this.on=Function.NOOP;var C=["input","select","textarea","button","a"].inject([B],function(D,E){
                    return D.concat($enumerate(B.getElementsByTagName(E)).toArray());
                }).collect(function(D){
                    var E=D.style.cursor;D.style.cursor="wait";return function(){
                        D.style.cursor=E;
                    };
                });this.off=function(){
                    C.broadcast();this.on=this.toggle;this.off=Function.NOOP;
                };
            };this.on=/Safari/.test(navigator.userAgent)?Function.NOOP:this.toggle;this.off=Function.NOOP;
        }
        });A.OverlayIndicator=Object.subclass({
        initialize:function(B){
            this.configuration=B;
        },
        on:function(){
            if(/MSIE/.test(navigator.userAgent)){
                this.overlay=document.createElement("iframe");this.overlay.setAttribute("src",this.configuration.connection.context.current+"xmlhttp/wait-cursor");this.overlay.setAttribute("frameborder","0");document.body.appendChild(this.overlay);
            }else{
                this.overlay=document.body.appendChild(document.createElement("div"));this.overlay.style.cursor="wait";
            }var B=this.overlay.style;B.position="absolute";B.backgroundColor="white";B.zIndex="38000";B.top="0";B.left="0";B.opacity="0";B.filter="alpha(opacity=0)";B.width=(Math.max(document.documentElement.scrollWidth,document.body.scrollWidth)-20)+"px";B.height=(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)-20)+"px";
        },
        off:function(){
            if(this.overlay){
                if(/MSIE/.test(navigator.userAgent)){
                    var B=document.createElement("iframe");B.setAttribute("src",this.configuration.connection.context.current+"xmlhttp/blank");B.setAttribute("frameborder","0");document.body.replaceChild(B,this.overlay);document.body.removeChild(B);
                }else{
                    document.body.removeChild(this.overlay);
                }
                }
            }
        });A.PopupIndicator=Object.subclass({
        initialize:function(F,E,D,C,B){
            this.message=F;this.description=E;this.buttonText=D;this.iconPath=C;this.panel=B;
        },
        on:function(){
            this.panel.on();var C=document.createElement("div");document.body.appendChild(C);var B=C.style;B.position="absolute";B.textAlign="center";B.zIndex="28001";B.color="black";B.backgroundColor="white";B.paddingLeft="0";B.paddingRight="0";B.paddingTop="15px";B.paddingBottom="15px";B.borderBottomColor="gray";B.borderRightColor="gray";B.borderTopColor="silver";B.borderLeftColor="silver";B.borderWidth="2px";B.borderStyle="solid";B.width="270px";var F=document.createElement("div");F.appendChild(document.createTextNode(this.message));var I=F.style;I.marginLeft="30px";I.textAlign="left";I.fontSize="14px";I.fontSize="14px";I.fontWeight="bold";C.appendChild(F);var E=document.createElement("div");E.appendChild(document.createTextNode(this.description));var H=E.style;H.fontSize="11px";H.marginTop="7px";H.marginBottom="7px";H.fontWeight="normal";F.appendChild(E);var G=document.createElement("input");G.type="button";G.value=this.buttonText;var J=G.style;J.fontSize="11px";J.fontWeight="normal";G.onclick=function(){
                window.location.reload();
            };C.appendChild(G);var D=function(){
                B.left=((window.width()-C.clientWidth)/2)+"px";B.top=((window.height()-C.clientHeight)/2)+"px";
            }.bind(this);D();window.onResize(D);
        },
        off:Function.NOOP
        });A.DefaultStatusManager=Object.subclass({
        initialize:function(G,D){
            this.configuration=G;this.container=D;this.connectionLostRedirect=G.connectionLostRedirectURI?new A.RedirectIndicator(G.connectionLostRedirectURI):null;this.sessionExpiredRedirect=G.sessionExpiredRedirectURI?new A.RedirectIndicator(G.sessionExpiredRedirectURI):null;var F=G.messages;var C=G.connection.context+"/xmlhttp/css/xp/css-images/connect_disconnected.gif";var E=G.connection.context+"/xmlhttp/css/xp/css-images/connect_caution.gif";var B=new A.PointerIndicator(D);this.busy=new A.OverlappingStateProtector(G.blockUI?new A.MuxIndicator(B,new A.OverlayIndicator(G)):B);this.sessionExpired=this.sessionExpiredRedirect?this.sessionExpiredRedirect:new A.PopupIndicator(F.sessionExpired,F.description,F.buttonText,C,this);this.connectionLost=this.connectionLostRedirect?this.connectionLostRedirect:new A.PopupIndicator(F.connectionLost,F.description,F.buttonText,E,this);this.serverError=new A.PopupIndicator(F.serverError,F.description,F.buttonText,E,this);this.connectionTrouble={
                on:Function.NOOP,
                off:Function.NOOP
                };
        },
        on:function(){
            var D=this.container.ownerDocument.createElement("iframe");D.setAttribute("src",this.configuration.connection.context.current+"xmlhttp/blank");D.setAttribute("frameborder","0");var B=D.style;B.position="absolute";B.display="block";B.visibility="visible";B.backgroundColor="white";B.zIndex="28000";B.top="0";B.left="0";B.opacity=0.22;B.filter="alpha(opacity=22)";this.container.appendChild(D);var C=this.container.tagName.toLowerCase()=="body"?function(){
                B.width=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth)+"px";B.height=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)+"px";
            }:function(){
                B.width=this.container.offsetWidth+"px";B.height=this.container.offsetHeight+"px";
            };C();window.onResize(C);
        },
        off:Function.NOOP
        });A.ComponentStatusManager=Object.subclass({
        initialize:function(F,N,J,E,H,B,M){
            var L=[];var C=new Ice.Status.ElementIndicator(F,L);var I=new Ice.Status.ElementIndicator(N,L);var D=new Ice.Status.ElementIndicator(E,L);var K=new Ice.Status.ToggleIndicator(C,I);var G=H.configuration.blockUI?new Ice.Status.MuxIndicator(K,new Ice.Status.OverlayIndicator(H.configuration)):K;this.busy=new Ice.Status.OverlappingStateProtector(M?new Ice.Status.MuxIndicator(H.busy,G):G);this.connectionTrouble=new Ice.Status.ElementIndicator(J,L);if(B){
                this.dsm=H;this.connectionLost=new Ice.Status.MuxIndicator(D,this.dsm.connectionLost);this.sessionExpired=new Ice.Status.MuxIndicator(D,this.dsm.sessionExpired);this.serverError=new Ice.Status.MuxIndicator(D,this.dsm.serverError);
            }else{
                this.connectionLost=H.connectionLostRedirect?H.connectionLostRedirect:D;this.sessionExpired=H.sessionExpiredRedirect?H.sessionExpiredRedirect:D;this.serverError=D;
            }
            },
        on:function(){
            this.dsm.on();
        },
        off:function(){
            [this.busy,this.sessionExpired,this.serverError,this.connectionLost,this.connectionTrouble].eachWithGuard(function(B){
                B.off();
            });
        }
        });
});
[Ice.Connection=new Object,Ice.Connection,Ice.Ajax,Ice.Parameter.Query].as(function(D,C,B,A){
    D.FormPost=function(E){
        E.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
    };D.Close=function(E){
        E.close();
    };D.BadResponse=function(E){
        return E.statusCode()==0;
    };D.ServerError=function(E){
        var F=E.statusCode();return F>=500&&F<600;
    };D.OK=function(E){
        return E.statusCode()==200;
    };D.Lock=Object.subclass({
        initialize:function(){
            var E=false;this.acquire=function(){
                E=true;
            }.bind(this);this.release=function(){
                E=false;
            }.bind(this);this.isReleased=function(){
                return !E;
            }.bind(this);
        }
        });D.NOOPLock=Object.subclass({
        initialize:function(){
            this.acquire=Function.NOOP;this.release=Function.NOOP;this.isReleased=function(){
                return true;
            };
        }
        });D.SyncConnection=Object.subclass({
        initialize:function(F,H,E){
            this.logger=F.child("sync-connection");this.channel=new B.Client(this.logger);this.defaultQuery=E;this.onSendListeners=[];this.onReceiveFromSendListeners=[];this.onReceiveListeners=[];this.onServerErrorListeners=[];this.connectionDownListeners=[];this.timeoutBomb={
                cancel:Function.NOOP
                };this.logger.info("synchronous mode");this.sendURI=H.context.current+"block/send-receive-updates";var G=H.timeout?H.timeout:60000;window.onBeforeUnload(function(){
                this.connectionDownListeners.clear();
            }.bind(this));this.onSend(function(){
                this.timeoutBomb.cancel();this.timeoutBomb=this.connectionDownListeners.broadcaster().delayExecutionFor(G);
            }.bind(this));this.onReceive(function(){
                this.timeoutBomb.cancel();
            }.bind(this));this.whenDown(function(){
                this.timeoutBomb.cancel();
            }.bind(this));this.receiveCallback=function(I){
                try{
                    this.onReceiveListeners.broadcast(I);
                }catch(J){
                    this.logger.error("receive broadcast failed",J);
                }
                }.bind(this);this.badResponseCallback=this.connectionDownListeners.broadcaster();this.serverErrorCallback=this.onServerErrorListeners.broadcaster();this.lock=H.blockUI?new C.Lock():new C.NOOPLock();
        },
        send:function(F){
            if(this.lock.isReleased()){
                this.lock.acquire();try{
                    var E=new A();E.addQuery(F);E.addQuery(this.defaultQuery);E.add("ice.focus",window.currentFocus);this.logger.debug("send > "+E.asString());this.channel.postAsynchronously(this.sendURI,E.asURIEncodedString(),function(H){
                        D.FormPost(H);H.on(C.OK,this.lock.release);H.on(C.OK,this.onReceiveFromSendListeners.broadcaster());H.on(C.OK,this.receiveCallback);H.on(C.BadResponse,this.badResponseCallback);H.on(C.ServerError,this.serverErrorCallback);H.on(C.OK,C.Close);this.onSendListeners.broadcast(H);
                    }.bind(this));
                }catch(G){
                    this.lock.release();
                }
                }
            },
        onSend:function(F,E){
            this.onSendListeners.push(F);if(E){
                this.onReceiveFromSendListeners.push(E);
            }
            },
        onReceive:function(E){
            this.onReceiveListeners.push(E);
        },
        onServerError:function(E){
            this.onServerErrorListeners.push(E);
        },
        whenDown:function(E){
            this.connectionDownListeners.push(E);
        },
        whenTrouble:Function.NOOP,
        shutdown:function(){
            this.shutdown=Function.NOOP;this.send=Function.NOOP;[this.onSendListeners,this.onReceiveListeners,this.onServerErrorListeners,this.connectionDownListeners,this.onReceiveFromSendListeners].eachWithGuard(function(E){
                E.clear();
            });
        }
        });
});
Ice.Community=new Object;
[Ice.Reliability=new Object].as(function(A){
    A.Heartbeat=Object.subclass({
        initialize:function(D,C,B){
            this.period=D;this.logger=B.child("heartbeat");this.pingListeners=[];this.lostPongListeners=[];this.beat=function(){
                var E=function(){
                    this.logger.warn("pong lost");this.lostPongListeners.each(function(F){
                        F.notify();
                    });
                }.bind(this).delayExecutionFor(C);this.pingListeners.broadcast(new A.Ping(E,this,this.logger));
            }.bind(this);window.onKeyPress(function(E){
                if(E.keyCode()==46&&E.isCtrlPressed()&&E.isShiftPressed()){
                    this.beatPID?this.stop():this.start();
                }
                }.bind(this));
        },
        start:function(){
            this.beatPID=this.beat.repeatExecutionEvery(this.period);this.logger.info("heartbeat started");return this;
        },
        stop:function(){
            try{
                this.beatPID.cancel();this.beatPID=null;this.pingListeners.clear();this.lostPongListeners.each(function(C){
                    C.ignoreNotifications();
                });this.logger.info("heartbeat stopped");
            }catch(B){
                this.logger.warn("heartbeat not started",B);
            }return this;
        },
        reset:function(){
            this.lostPongListeners.each(function(B){
                B.reset();
            });
        },
        onPing:function(B){
            this.pingListeners.push(B);
        },
        onLostPongs:function(D,C){
            var B=C||1;this.lostPongListeners.push(new A.CoalescingListener(B,D));
        }
        });A.Ping=Object.subclass({
        initialize:function(B,D,C){
            this.pid=B;this.heartbeat=D;this.logger=C;this.logger.info("ping");
        },
        pong:function(){
            if(this.pid){
                this.heartbeat.reset();this.pid.cancel();this.pong=Function.NOOP;this.logger.info("pong");
            }
            }
        });A.CoalescingListener=Object.subclass({
        initialize:function(B,C){
            this.count=0;this.retries=B;this.callback=C;
        },
        notify:function(){
            this.count+=1;if(this.count==this.retries){
                this.callback();this.reset();
            }
            },
        ignoreNotifications:function(){
            this.notify=Function.NOOP;
        },
        reset:function(){
            this.count=0;
        }
        });
});
[Ice.Community.Connection=new Object,Ice.Connection,Ice.Ajax,Ice.Reliability.Heartbeat,Ice.Cookie,Ice.Parameter.Query].as(function(F,E,C,D,A,B){
    F.AsyncConnection=Object.subclass({
        initialize:function(g,U,Z,V,M,Y){
            this.logger=g.child("async-connection");this.sendChannel=new C.Client(this.logger.child("ui"));this.receiveChannel=new C.Client(this.logger.child("blocking"));this.defaultQuery=M;this.onSendListeners=[];this.onReceiveFromSendListeners=[];this.onReceiveListeners=[];this.onServerErrorListeners=[];this.connectionDownListeners=[];this.connectionTroubleListeners=[];this.listener={
                close:Function.NOOP,
                abort:Function.NOOP
                };this.listening={
                remove:Function.NOOP
                };this.timeoutBomb={
                cancel:Function.NOOP
                };this.heartbeat={
                stop:Function.NOOP
                };this.pingURI=V.context.current+"block/ping";this.getURI=V.context.current+"block/receive-updates";this.sendURI=V.context.current+"block/send-receive-updates";this.receiveURI=V.context.async+"block/receive-updated-views";window.onBeforeUnload(function(){
                this.connectionDownListeners.clear();
            }.bind(this));var Q=V.timeout?V.timeout:60000;this.onSend(function(){
                this.timeoutBomb.cancel();this.timeoutBomb=this.connectionDownListeners.broadcaster().delayExecutionFor(Q);
            }.bind(this));this.onReceive(function(){
                this.timeoutBomb.cancel();
            }.bind(this));this.serverErrorCallback=this.onServerErrorListeners.broadcaster();this.receiveCallback=function(i){
                try{
                    this.onReceiveListeners.broadcast(i);
                }catch(j){
                    this.logger.error("receive broadcast failed",j);
                }
                }.bind(this);this.sendXWindowCookie=Function.NOOP;this.receiveXWindowCookie=function(e){
                var i=e.getResponseHeader("X-Set-Window-Cookie");if(i){
                    this.sendXWindowCookie=function(j){
                        j.setRequestHeader("X-Window-Cookie",i);
                    };
                }
                }.bind(this);try{
                this.updatedViews=A.lookup("updates");
            }catch(b){
                this.updatedViews=new A("updates","");
            }Y.register("updated-views",function(i){
                var e=this.updatedViews.loadValue().split(" ");var j=i.firstChild;if(j&&!j.data.blank()){
                    this.updatedViews.saveValue(e.concat(j.data.split(" ")).asSet().join(" "));
                }else{
                    this.logger.warn("No updated views were returned.");
                }
                }.bind(this));try{
                this.listening=A.lookup("bconn");this.listening.remove();
            }catch(b){}var h=function(k,e,i){
                var j=0;var l=i.inject([e],function(n,m){
                    n.unshift(k.delayFor(m));return n;
                });return function(){
                    if(j<l.length){
                        l[j].apply(this,arguments);j++;
                    }
                    };
            };function a(){
                return A.lookup("ice.sessions").loadValue().split(" ").collect(function(e){
                    return e.split("#")[0];
                });
            }this.connect=function(){
                this.logger.debug("closing previous connection...");this.listener.close();this.logger.debug("connect...");var e=new B();a().each(function(i){
                    e.add("ice.session",i);
                });this.listener=this.receiveChannel.postAsynchronously(this.receiveURI,e.asURIEncodedString(),function(i){
                    this.sendXWindowCookie(i);E.FormPost(i);i.on(E.ServerError,K);i.on(E.OK,this.receiveXWindowCookie);i.on(E.OK,function(j){
                        if(!j.isEmpty()){
                            this.receiveCallback(j);
                        }if(j.getResponseHeader("X-Connection")!="close"){
                            this.connect();
                        }
                        }.bind(this));i.on(E.OK,E.Close);
                }.bind(this));
            }.bind(this);var K=h(this.connect,this.serverErrorCallback,V.serverErrorRetryTimeouts||[1000,2000,4000]);Y.register("pong",Function.NOOP);var H=V.heartbeat.interval?V.heartbeat.interval:50000;var L=V.heartbeat.timeout?V.heartbeat.timeout:30000;var c=V.heartbeat.retries?V.heartbeat.retries:3;var R=function(){
                this.heartbeat.stop();this.heartbeat=new D(H,L,this.logger);this.heartbeat.onPing(function(e){
                    Y.register("pong",function(){
                        e.pong();
                    });this.sendChannel.postAsynchronously(this.pingURI,this.defaultQuery.asURIEncodedString(),function(i){
                        E.FormPost(i);i.on(E.OK,this.receiveCallback);i.on(E.OK,E.Close);
                    }.bind(this));
                }.bind(this));this.heartbeat.onLostPongs(this.connectionDownListeners.broadcaster(),c);this.heartbeat.onLostPongs(this.connectionTroubleListeners.broadcaster());this.heartbeat.onLostPongs(function(){
                    this.logger.debug("retry to connect...");this.connect();
                }.bind(this));this.heartbeat.start();this.connect();
            }.bind(this);var P=1000;var f=U+":"+Z;var d=A.lookup("ice.lease",(new Date).getTime().toString());var W=this.listening=A.lookup("bconn","-");function J(){
                d.saveValue((new Date).getTime()+P*2);
            }function G(){
                return d.loadValue().asNumber()<(new Date).getTime();
            }function I(){
                return !A.exists("bconn")||A.lookup("bconn").value=="-";
            }function N(){
                W.saveValue(f);
            }function S(){
                return W.loadValue().startsWith(f);
            }function O(){
                W.saveValue(f+":acquired");
            }function X(){
                return W.loadValue().endsWith(":acquired");
            }this.blockingConnectionMonitor=function(){
                if(I()){
                    N();this.logger.info("blocking connection not initialized...candidate for its creation");
                }else{
                    if(S()){
                        if(!X()){
                            O();R();
                        }J();
                    }if(X()&&G()){
                        N();this.logger.info("blocking connection lease expired...candidate for its creation");
                    }
                    }
                }.bind(this).repeatExecutionEvery(P);var T=function(){
                this.sendChannel.postAsynchronously(this.getURI,this.defaultQuery.asURIEncodedString(),function(e){
                    E.FormPost(e);e.on(E.OK,this.receiveCallback);e.on(E.OK,E.Close);
                }.bind(this));
            }.bind(this);T.delayExecutionFor(P);this.updatesMonitor=function(){
                try{
                    var i=this.updatedViews.loadValue().split(" ");if(i.include(f)){
                        T();this.updatedViews.saveValue(i.complement([f]).join(" "));
                    }
                    }catch(j){
                    this.logger.warn("failed to listen for updates",j);
                }
                }.bind(this).repeatExecutionEvery(300);this.lock=V.blockUI?new E.Lock():new E.NOOPLock();this.logger.info("asynchronous mode");
        },
        send:function(H){
            if(this.lock.isReleased()){
                this.lock.acquire();try{
                    var G=new B();G.addQuery(H);G.addQuery(this.defaultQuery);G.add("ice.focus",window.currentFocus);this.logger.debug("send > "+G.asString());this.sendChannel.postAsynchronously(this.sendURI,G.asURIEncodedString(),function(J){
                        E.FormPost(J);J.on(E.OK,this.lock.release);J.on(E.OK,this.onReceiveFromSendListeners.broadcaster());J.on(E.OK,this.receiveCallback);J.on(E.ServerError,this.serverErrorCallback);J.on(E.OK,E.Close);this.onSendListeners.broadcast();
                    }.bind(this));
                }catch(I){
                    this.lock.release();
                }
                }
            },
        onSend:function(H,G){
            this.onSendListeners.push(H);if(G){
                this.onReceiveFromSendListeners.push(G);
            }
            },
        onReceive:function(G){
            this.onReceiveListeners.push(G);
        },
        onServerError:function(G){
            this.onServerErrorListeners.push(G);
        },
        whenDown:function(G){
            this.connectionDownListeners.push(G);
        },
        whenTrouble:function(G){
            this.connectionTroubleListeners.push(G);
        },
        shutdown:function(){
            try{
                this.shutdown=Function.NOOP;this.send=Function.NOOP;this.connect=Function.NOOP;this.heartbeat.stop();
            }catch(G){}finally{
                [this.onSendListeners,this.onReceiveListeners,this.connectionDownListeners,this.onServerErrorListeners,this.onReceiveFromSendListeners].eachWithGuard(function(H){
                    H.clear();
                });this.listener.abort();[this.updatesMonitor,this.blockingConnectionMonitor].eachWithGuard(function(H){
                    H.cancel();
                });this.listening.remove();
            }
            }
        });
});
window.logger=new Ice.Log.Logger(["window"]);window.console&&window.console.firebug?new Ice.Log.FirebugLogHandler(window.logger):new Ice.Log.WindowLogHandler(window.logger,window);[Ice.Community].as(function(D){
    var E=function(Q){
        try{
            var N=Ice.Cookie.lookup("ice.sessions");var R=N.loadValue().split(" ");var M=function(S){
                return S.startsWith(Q);
            };var P=R.detect(M);if(P){
                R=R.reject(M);var L=P.split("#")[1].asNumber()+1;R.push(Q+"#"+L);
            }else{
                R.push(Q+"#"+1);
            }N.saveValue(R.join(" "));
        }catch(O){
            new Ice.Cookie("ice.sessions",Q+"#"+1);
        }
        };var F=function(M){
        if(Ice.Cookie.exists("ice.sessions")){
            var L=Ice.Cookie.lookup("ice.sessions");var N=L.loadValue().split(" ");L.saveValue(N.inject([],function(O,Q){
                if(Q){
                    var R=Q.split("#");var S=R[0];var P=R[1].asNumber();if(S==M){
                        --P;
                    }if(P>0){
                        O.push(R[0]+"#"+P);
                    }
                    }return O;
            }).join(" "));
        }
        };var K=window.views=window.views?window.views:[];var J=function(M,L){
        E(M);K.push(new Ice.Parameter.Association(M,L));
    };var C=function(){
        K.each(function(L){
            F(L.name);
        });K.clear();
    };var I=new Ice.Ajax.Client(logger.child("dispose"));var B=function(L){
        if(L.isEmpty()){
            return ;
        }try{
            var M=L.inject(new Ice.Parameter.Query(),function(O,P){
                return O.addParameter(P);
            });I.postSynchronously(window.disposeViewsURI,M.asURIEncodedString(),function(O){
                Ice.Connection.FormPost(O);O.on(Ice.Connection.OK,Ice.Connection.Close);
            });
        }catch(N){
            logger.warn("Failed to notify view disposal",N);
        }
        };var G=function(M,L){
        F(M);K=K.reject(function(N){
            return N.name==M&&N.value==L;
        });
    };var H=function(M,L){
        G(M,L);B([new Ice.Parameter.Association(M,L)]);
    };var A=function(){
        B(K);C();
    };window.onBeforeUnload(A);D.Application=Object.subclass({
        initialize:function(P,M){
            var U=P.session;var Q=P.view;J(U,Q);var X=window.logger.child(U.substring(0,4)+"#"+Q);var T=new Ice.Status.DefaultStatusManager(P,M);var L=new Ice.Script.Loader(X);var Z=new Ice.Command.Dispatcher();var S=new Ice.Document.Synchronizer(window.logger,U,Q);var W=Ice.Parameter.Query.create(function(a){
                a.add("ice.session",U);a.add("ice.view",Q);
            });var O=function(a){
                Ice.Document.replaceContainerHTML(M,a);L.searchAndEvaluateScripts(M);
            };var N=P.synchronous?new Ice.Connection.SyncConnection(X,P.connection,W):new D.Connection.AsyncConnection(X,U,Q,P.connection,W,Z);var V=function(){
                V=Function.NOOP;N.shutdown();S.shutdown();
            };var R=[];var Y=function(a){
                R.push(a);
            };Z.register("noop",Function.NOOP);Z.register("set-cookie",Ice.Command.SetCookie);Z.register("parsererror",Ice.Command.ParsingError);Z.register("redirect",function(b){
                var a=b.getAttribute("url").replace(/&#38;/g,"&");X.info("Redirecting to "+a);window.location.href=a;
            });Z.register("reload",function(d){
                X.info("Reloading");var c=window.location.href;B=Function.NOOP;V();if(c.contains("rvn=")){
                    window.location.reload();
                }else{
                    var a=d.getAttribute("view");if(a==""){
                        window.location.reload();
                    }else{
                        var b=c.contains("?")?"&":"?";window.location.href=c+b+"rvn="+a;
                    }
                    }
                });Z.register("macro",function(a){
                $enumerate(a.childNodes).each(function(b){
                    Z.deserializeAndExecute(b);
                });
            });Z.register("updates",function(a){
                $enumerate(a.getElementsByTagName("update")).each(function(d){
                    try{
                        var b=d.getAttribute("address");var g=new Ice.ElementModel.Update(d);b.asExtendedElement().updateDOM(g);X.debug("applied update : "+g.asString());var c=b.asElement();Ice.Focus.captureFocusIn(c);L.searchAndEvaluateScripts(c);if(Ice.StateMon){
                            Ice.StateMon.checkAll();Ice.StateMon.rebuild();
                        }
                        }catch(f){
                        X.error("failed to insert element: "+g.asString(),f);
                    }
                    });
            });Z.register("session-expired",function(){
                try{
                    X.warn("Session has expired");T.busy.off();T.sessionExpired.on();G(U,Q);
                }finally{
                    V();R.broadcast();
                }
                });window.onUnload(function(){
                V();
            });N.onSend(function(){
                T.busy.on();
            },function(){
                T.busy.off();
            });N.onReceive(function(a){
                var b=a.getResponseHeader("Content-Type");if(b.startsWith("text/html")){
                    O(a.content());
                }else{
                    if(b.startsWith("text/xml")){
                        S.synchronize();Z.deserializeAndExecute(a.contentAsDOM().documentElement);
                    }else{
                        X.warn("unknown content in response");
                    }
                    }T.connectionTrouble.off();
            });N.onServerError(function(a){
                X.warn("server side error");T.busy.off();H(U,Q);if(a.isEmpty()){
                    T.serverError.on();
                }else{
                    O(a.content());
                }V();
            });N.whenDown(function(){
                X.warn("connection to server was lost");T.busy.off();T.connectionLost.on();V();
            });N.whenTrouble(function(){
                X.warn("connection in trouble");T.connectionTrouble.on();
            });this.attachStatusManager=function(a){
                T.off();T=a(new Ice.Status.DefaultStatusManager(P,M));X.info("status indicators were updated");
            };this.connection=N;this.onSessionExpired=Y;this.dispose=V;this.disposeAndNotify=function(){
                H(U,Q);V();
            };X.info("bridge loaded!");
        }
        });
});window.onKeyPress(function(A){
    if(A.isEscKey()){
        A.cancelDefaultAction();
    }
    });
[Ice].as(function(A){
    function B(H){
        try{
            return H.asExtendedElement().findBridge();
        }catch(F){
            var E=H.asElement().getElementsByTagName("*");var D=E.length;for(var C=0;C<D;C++){
                var G=E[C];if(G.bridge){
                    return G.bridge;
                }
                }throw"Cannot find bridge instance among the children or parents of ["+H+"]";
        }
        }window.disposeOnViewRemoval=function(C){
        B(C).disposeAndNotify();
    };A.onSendReceive=function(E,D,C){
        B(E).connection.onSend(D,C);
    };A.onAsynchronousReceive=function(D,C){
        B(D).connection.onReceive(C);
    };A.onServerError=function(D,C){
        B(D).connection.onServerError(function(E){
            C(E.content());
        });
    };A.onSessionExpired=function(D,C){
        B(D).onSessionExpired(C);
    };A.onConnectionTrouble=function(D,C){
        B(D).connection.whenTrouble(C);
    };A.onConnectionLost=function(D,C){
        B(D).connection.whenDown(C);
    };
});
if(typeof OpenAjax!="undefined"&&typeof OpenAjax.registerLibrary!="undefined"&&typeof OpenAjax.registerGlobals!="undefined"){
    OpenAjax.registerLibrary("icefaces-d2d","http://www.icefaces.org/","1.5.3");OpenAjax.registerGlobals("icefaces-d2d",["Class","Enumerable","iceSubmit","$A","resetHiddenFieldsFor","$H","setFocus","property","$R","$break","Hashtable","ObjectRange","$w","Template","current","$continue","PeriodicalExecuter","Try","currentFocus","Abstract","Ice","iceSubmitPartial"]);
}
